Implement dual target-close paths and residual option expiry.

Document and enforce: A full dual-leg close, B perp-only when deep OTM with residual archive that does not block next open, and expiry settlement when target is missed.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-26 18:32:05 +08:00
parent 96e8e5cb70
commit 4994aaab16
14 changed files with 595 additions and 118 deletions
+12
View File
@@ -144,6 +144,18 @@ def test_expiry_close() -> None:
assert d3.should_close is True
def test_deep_otm_and_expiry_settle() -> None:
from app.sim.pricing import is_deep_otm, option_expiry_settle, option_intrinsic
assert is_deep_otm(option_side="call", strike=1860, spot=1840) is True
assert is_deep_otm(option_side="call", strike=1860, spot=1882) is False
assert is_deep_otm(option_side="put", strike=1860, spot=1882) is True
assert option_intrinsic(option_side="call", strike=1860, spot=1840) == 0.0
settled = option_expiry_settle(intrinsic=0.0, qty_eth=2.0, fee_rate=0.0005)
assert settled.fill_px == 0.0
assert settled.notional == 0.0
def test_option_intrinsic_and_close_bid_floor() -> None:
from app.sim.pricing import (
option_expiry_settle,