Estimate missing option ask from mark or intrinsic on chain list.

Deep ITM contracts often have no ask on the book; show mark-based estimates with a tilde and restore breakeven calculations.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-07 17:50:25 +08:00
parent 25879dd007
commit 7f225c7407
4 changed files with 89 additions and 10 deletions
+15
View File
@@ -90,6 +90,21 @@ def test_estimate_expiry_profit_at_index():
assert p2 == round(-12.2 * 0.01, 4)
def test_resolve_chain_quote_estimated_ask():
from lib.exchange.okx_options_lib import _resolve_chain_quote
q = _resolve_chain_quote(
ticker={"bidPx": "0.2", "bidSz": "3500"},
meta={"tickSz": "0.2"},
opt_type="C",
strike=1650,
index_px=1776,
)
assert q["ask_estimated"] is True
assert q["ask"] is not None
assert q["ask"] >= 120
def test_format_quote_liquidity():
from lib.options.options_pricing_lib import format_quote_liquidity