Treat exchange as LIVE SoT: expiry closes perp only, no invented option settles.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-08 15:44:15 +08:00
parent 4fe15c41fa
commit 99e58910d3
8 changed files with 1010 additions and 303 deletions
+25 -15
View File
@@ -1080,23 +1080,33 @@ class StrategyEngine:
if close_full is not None and (
expired.should_close or bypass or reason == "emergency"
):
# LIVE:先交易所卖两腿
for sell_fn_name in (
"_live_sell_oo_both",
"live_sell_oo_both",
):
sell_both = getattr(self.matcher, sell_fn_name, None)
if callable(sell_both):
try:
await asyncio.to_thread(
sell_both, bypass_liquidity=bypass
)
except Exception:
logger.exception("live sell oo both failed")
break
oo_reason = (
reason if reason != "liquidity_retry" else "expiry"
)
# LIVE:到期不卖(交易所自动结算);紧急等才卖两腿
if oo_reason != "expiry":
for sell_fn_name in (
"_live_sell_oo_both",
"live_sell_oo_both",
):
sell_both = getattr(self.matcher, sell_fn_name, None)
if callable(sell_both):
try:
await asyncio.to_thread(
sell_both,
bypass_liquidity=bypass,
reason=oo_reason,
)
except TypeError:
await asyncio.to_thread(
sell_both, bypass_liquidity=bypass
)
except Exception:
logger.exception("live sell oo both failed")
break
r = await asyncio.to_thread(
close_full,
reason=reason if reason != "liquidity_retry" else "expiry",
reason=oo_reason,
bypass_liquidity=True,
)
if r.ok: