Go-live gate: refuse unsafe live trading

Setting MODE=live alone no longer starts trading. check_live_ready requires an
active risk limit, MAX_POSITION_PCT < 1.0, LIVE_CONFIRMATION exactly
"I UNDERSTAND THE RISK", a minimum balance, and exchange credentials. Enforced
in Runtime.start_many (both start paths) and surfaced at GET /api/live-check;
the dashboard shows a banner and blocks the start buttons. Adds tests.
This commit is contained in:
matitos committed 2026-09-22 12:55:12 +00:00
1 parent b60cddf13d
commit 0173e46cfb
10 files changed
+241 -1

No files matched your search

+7
View File
@@ -39,6 +39,13 @@ class Settings(BaseSettings):
exchange_api_secret: str = ""
exchange_sandbox: bool = False
# --- Go-live gate ---
# Live trading only starts when this is exactly "I UNDERSTAND THE RISK".
# It is deliberately not a boolean: setting MODE=live alone is not enough.
live_confirmation: str = ""
# Refuse to start live below this account size (quote currency).
min_live_balance: float = 100.0
# --- Risk controls (0 disables a limit) ---
# Absolute loss in quote currency since the start of the UTC day.
max_daily_loss: float = 0.0