Align emergency option close to OKX: use bid only, never mark.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-30 17:15:38 +08:00
parent 2b7c504134
commit 021b0d0a22
4 changed files with 139 additions and 143 deletions
+6 -6
View File
@@ -214,14 +214,14 @@ def test_option_intrinsic_and_close_bid_floor() -> None:
assert settled.notional == 44.0
assert abs(settled.fee - 44.0 * 0.0005) < 1e-12
# 紧急垃圾买一 0.2,内在价值 22 → 抬到 22
# 紧急:对齐 OKX 市价卖,只按买一(垃圾买一不抬到内在价值/标记)
assert (
resolve_option_close_bid(
bid=0.2, mark=0.2, intrinsic=22.0, bypass_liquidity=True
bid=0.2, mark=22.0, intrinsic=22.0, bypass_liquidity=True
)
== 22.0
== 0.2
)
# 常规也有内在价值地板
# 常规内在价值地板
assert (
resolve_option_close_bid(
bid=0.2, mark=0.2, intrinsic=22.0, bypass_liquidity=False
@@ -235,10 +235,10 @@ def test_option_intrinsic_and_close_bid_floor() -> None:
)
== 25.0
)
# bypass 无买一,用标记与内在价值
# 紧急无买一 → 无法定价(不能用标记)
assert (
resolve_option_close_bid(
bid=None, mark=3.0, intrinsic=22.0, bypass_liquidity=True
)
== 22.0
is None
)