[Unit] Description=Foxhunt Trading Service (Monolithic) Documentation=https://github.com/foxhunt/trading-system After=network.target docker.service foxhunt-database-stack.service Wants=network.target Requires=foxhunt-database-stack.service [Service] Type=exec User=foxhunt Group=foxhunt WorkingDirectory=/opt/foxhunt Environment=RUST_LOG=info Environment=FOXHUNT_CONFIG_PATH=/opt/foxhunt/config Environment=DATABASE_URL=postgresql://foxhunt:foxhunt@localhost:5432/foxhunt Environment=REDIS_URL=redis://localhost:6379 EnvironmentFile=-/opt/foxhunt/config/.env ExecStart=/opt/foxhunt/bin/trading-service --config /opt/foxhunt/config/trading.toml ExecReload=/bin/kill -HUP $MAINPID Restart=always RestartSec=10 StandardOutput=journal StandardError=journal SyslogIdentifier=foxhunt-trading # Security settings NoNewPrivileges=true PrivateTmp=true ProtectSystem=strict ProtectHome=true ReadWritePaths=/opt/foxhunt/logs /opt/foxhunt/data CapabilityBoundingSet=CAP_NET_BIND_SERVICE # Resource limits optimized for HFT trading LimitNOFILE=65536 LimitNPROC=8192 MemoryHigh=8G MemoryMax=16G CPUQuota=800% # Performance settings for low-latency trading CPUAffinity=0-7 IOSchedulingClass=1 IOSchedulingPriority=2 # HFT optimizations OOMScoreAdjust=-100 LimitMEMLOCK=infinity [Install] WantedBy=multi-user.target