Fix OKX abandon residual double-book and fill/residual ledger holes.

After dual-close leaves option pending, continue close_group instead of false residual; reject partial fills on wait timeout; LIVE residual settle allow_negative.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-29 20:20:36 +08:00
parent ec87cf2104
commit 44fd0371b9
7 changed files with 71 additions and 44 deletions
+18
View File
@@ -241,6 +241,24 @@ class StrategyEngine:
close_data = r.data
if r.ok:
self.enter_rest_after_close()
elif st == "opening":
# 开仓未确认:不自动清槽(可能期权已成交);紧急全平仅告警,防重复开
ok = False
detail = (
"stuck opening:请核对交易所期权/永续后人工处理"
"(已占槽防重复开,紧急全平不会自动释放)"
)
close_data = {"status": "opening"}
try:
from ..notify import wecom
wecom.notify_fault(
title="紧急全平遇到 stuck opening",
detail=detail,
dedupe_key="emergency:opening",
)
except Exception:
pass
elif st in ("open", "option_closed_perp_pending"):
# A:双腿(或续平永续)
r = self.matcher.close_group(reason="emergency", bypass_liquidity=True)