Fix LIVE open/close double-book and security audit findings.
Prevent expiry dual-close from re-booking option cash, abandon ledger rejection, margin-mode mismatch, and manual close races; harden fill wait and refuse default AUTH_SECRET on LIVE. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -233,6 +233,17 @@ async def put_strategy_settings(
|
||||
)
|
||||
equity_to_apply = new_eq
|
||||
|
||||
if "perp_margin_mode" in data:
|
||||
new_mm = str(data["perp_margin_mode"]).strip().lower()
|
||||
old_mm = str(
|
||||
db.get_setting("perp_margin_mode", s.perp_margin_mode) or s.perp_margin_mode
|
||||
).strip().lower()
|
||||
if new_mm != old_mm and Matcher(db).has_open_position():
|
||||
raise HTTPException(
|
||||
status_code=409,
|
||||
detail="有未平仓,无法切换永续保证金模式;请先平仓后再改",
|
||||
)
|
||||
|
||||
for k, v in data.items():
|
||||
if k in KEYS:
|
||||
db.set_setting(k, str(v))
|
||||
|
||||
Reference in New Issue
Block a user