Fix target-exit mismatch: correct close reason and executable PnL gate.
Locked premium exits no longer label as fixed_usdt; mark/book optimism no longer triggers close into a realized loss. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -882,6 +882,17 @@ class StrategyEngine:
|
||||
locked_exit_target=locked_exit,
|
||||
)
|
||||
pending_close = st["phase"] in ("liquidity_wait", "closing")
|
||||
# 曾因达标进入流动性等待,但当前估价已跌破目标:取消挂起,避免硬平出亏损却仍记「达标」
|
||||
if (
|
||||
pending_close
|
||||
and not expired.should_close
|
||||
and not decision.should_close
|
||||
):
|
||||
self._set_state(
|
||||
phase="open",
|
||||
last_error="达标后流动性等待期间浮盈回落,已取消平仓挂起",
|
||||
)
|
||||
return
|
||||
if expired.should_close or decision.should_close or pending_close:
|
||||
is_oo = (
|
||||
str(upl.get("hedge_mode") or "") == "option_option"
|
||||
|
||||
Reference in New Issue
Block a user