fix: 交易安全审计修复 — 补偿平仓、中控同步、滚仓/趋势防护
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -453,8 +453,11 @@ def cancel_orders_for_symbol(
|
||||
try:
|
||||
cancel_order(ex, exchange_kind, symbol, o["id"], o.get("channel") or "regular")
|
||||
n += 1
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
print(
|
||||
f"[cancel_orders_for_symbol] {exchange_kind} {symbol} id={o.get('id')}: {e}",
|
||||
flush=True,
|
||||
)
|
||||
return n
|
||||
|
||||
|
||||
@@ -655,7 +658,7 @@ def _gate_place_tp_sl_position(
|
||||
try:
|
||||
ex.privateFuturesPostSettlePriceOrders(_payload(tp_s, tp_rule))
|
||||
except Exception:
|
||||
cancel_orders_for_symbol(ex, "gate", symbol, scope="conditional")
|
||||
# 保留已挂止损,仅放弃本次 TP
|
||||
raise
|
||||
return
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user