Live Trading Gate (P0-3)
Production must remain paper-only until explicit operator promotion.
Required .env on droplet (/opt/trading/.env)
| Variable | Paper (default) | Live (after sign-off) |
|---|---|---|
ALPACA_BASE_URL |
https://paper-api.alpaca.markets |
https://api.alpaca.markets |
QGTM_LIVE_TRADING_ENABLED |
false (or unset) |
true |
Enforcement layers
Settingsvalidator (qgtm_core/config.py) — rejects incoherent pairs at import:- Live URL without
QGTM_LIVE_TRADING_ENABLED=true→ ValueError QGTM_LIVE_TRADING_ENABLED=truewith paper URL → ValueErrorTradingDaemon.run()— refuses to start ifis_liveis false while URL is live-shaped (legacy path).AlpacaBroker.submit_order()— rejects orders when not paper and gate is false.
Verification (post-deploy)
curl -sf -H "X-QGTM-API-Key: $QGTM_API_KEY" \
http://127.0.0.1:8000/api/v1/daemon/telemetry | jq '.paper, .live_trading_enabled'
Expect: paper: true, live_trading_enabled: false.
See also: docs/secrets-reference.md, SECURITY.md.