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:
1 parent
b60cddf13d
commit
0173e46cfb
10 files changed
+241
-1
No files matched your search
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user