Harden LIVE opens with slot claim and exchange reconcile.
Prevent duplicate opens by atomically claiming an opening slot, verifying exchange perp is flat before live orders, setting leverage from ledger, and preferring exchange position size when closing perps. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -50,6 +50,13 @@ async def lifespan(app: FastAPI):
|
||||
logger.info("LIVE startup: forced strategy pause (manual start required)")
|
||||
except Exception:
|
||||
logger.exception("LIVE startup force-pause failed")
|
||||
try:
|
||||
from .live import get_executor
|
||||
from .live.reconcile import log_exchange_db_mismatch
|
||||
|
||||
log_exchange_db_mismatch(get_executor(db))
|
||||
except Exception:
|
||||
logger.exception("LIVE startup reconcile log failed")
|
||||
engine.ensure_loop()
|
||||
|
||||
session = bootstrap_session(settings)
|
||||
|
||||
Reference in New Issue
Block a user