feat: options sheet sizing, ITM/OTM labels, and 14-day chain view

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-07 09:06:45 +08:00
parent d6d1ac5818
commit c1647822fb
8 changed files with 172 additions and 29 deletions
+4 -1
View File
@@ -7,7 +7,7 @@ from typing import Any, Callable
import ccxt
from lib.options.options_pricing_lib import is_shallow_itm
from lib.options.options_pricing_lib import is_shallow_itm, option_moneyness, option_moneyness_label
def create_options_exchange(
@@ -251,6 +251,7 @@ def build_option_chain(
bid = _safe_float(t.get("bidPx"))
if ask is None and bid is None:
continue
mny = option_moneyness(opt_type=opt_type, strike=strike, index_px=idx)
exp_key = str(exp_ms)
expiries.setdefault(exp_key, []).append(
{
@@ -260,6 +261,8 @@ def build_option_chain(
"exp_time": exp_ms,
"ask": ask,
"bid": bid,
"moneyness": mny,
"moneyness_label": option_moneyness_label(mny),
"ct_mult": _safe_float(meta.get("ctMult")) or 0.01,
"tick_sz": meta.get("tickSz"),
"min_sz": int(_safe_float(meta.get("minSz")) or 1),