Add pre-buy expiry breakeven columns to options chain table.

Show estimated expiry balance and distance from index in the chain list and order panel using ask price before opening a position.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-07 16:21:22 +08:00
parent 3570a6900e
commit 99f13817f8
6 changed files with 96 additions and 8 deletions
+12
View File
@@ -134,6 +134,18 @@ def option_moneyness_label(moneyness: str) -> str:
return {"itm": "实值", "otm": "虚值", "atm": "平值"}.get((moneyness or "").lower(), "")
def expiry_breakeven_from_ask(
*,
opt_type: str,
strike: float | None,
ask_px: float | None,
mark_px: float | None = None,
) -> float | None:
"""买入前预估到期平衡:权利金按卖一;无卖一时回退标记价。"""
prem = ask_px if ask_px is not None and ask_px > 0 else mark_px
return expiry_breakeven_px(opt_type=opt_type, strike=strike, avg_px=prem)
def expiry_breakeven_px(
*,
opt_type: str,