Align emergency option close to OKX: use bid only, never mark.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -68,21 +68,17 @@ def resolve_option_close_bid(
|
||||
bypass_liquidity: bool,
|
||||
) -> float | None:
|
||||
"""
|
||||
非到期平仓用买一价;多头卖出不得低于内在价值(SIM)。
|
||||
紧急 bypass:max(买一, 标记, 内在价值)。
|
||||
非到期平仓价(SIM)。
|
||||
- 常规:买一,且多头卖出不低于内在价值。
|
||||
- 紧急 bypass:对齐 OKX 市价卖,**只按买一**(不用标记/内在价值抬价;
|
||||
标记无法在交易所成交)。bypass 只绕过深度/偏差闸门。
|
||||
到期请用 option_expiry_settle,不要走本函数。
|
||||
"""
|
||||
candidates: list[float] = []
|
||||
if bid is not None and bid >= 0:
|
||||
candidates.append(float(bid))
|
||||
if bypass_liquidity and mark is not None and mark >= 0:
|
||||
candidates.append(float(mark))
|
||||
if intrinsic is not None and intrinsic >= 0:
|
||||
candidates.append(float(intrinsic))
|
||||
if not candidates:
|
||||
return None
|
||||
_ = mark # 保留参数兼容调用方;紧急不再用标记定价
|
||||
if bypass_liquidity:
|
||||
return max(candidates)
|
||||
if bid is None or bid < 0:
|
||||
return None
|
||||
return float(bid)
|
||||
if bid is None:
|
||||
return None
|
||||
if intrinsic is not None and intrinsic >= 0:
|
||||
|
||||
Reference in New Issue
Block a user