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

+6
View File
@@ -103,6 +103,12 @@ def multi_status(runtime: GuardedRuntimeDep) -> MultiStatusOut:
return runtime.multi_status()
@router.get("/live-check")
def live_check(runtime: GuardedRuntimeDep) -> dict:
"""Preflight for live trading: whether the config is safe enough."""
return runtime.live_check()
@router.post("/bot/start-many", response_model=MultiStatusOut)
async def start_many(payload: StartManyRequest, runtime: GuardedRuntimeDep) -> MultiStatusOut:
try: