距平衡改为行权价到平衡价的价差

Call 为 BE−K、Put 为 K−BE;链/下单/持仓统一;顺带修复 format_position_row 中 row_mode 引用顺序。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-23 08:21:31 +08:00
parent 57cca5554e
commit aa1a2da2b7
5 changed files with 45 additions and 18 deletions
+19
View File
@@ -531,6 +531,25 @@ def idx_distance_to_be(idx_px: float | None, be_px: float | None) -> float | Non
return round(float(be_px) - float(idx_px), 2)
def strike_distance_to_be(
strike: float | None,
be_px: float | None,
*,
opt_type: str | None = None,
) -> float | None:
"""行权价到到期平衡价的价差(Call:BEK, Put:KBE)."""
if strike is None or be_px is None:
return None
k = float(strike)
be = float(be_px)
o = (opt_type or "").upper()
if o == "C":
return round(be - k, 2)
if o == "P":
return round(k - be, 2)
return round(abs(be - k), 2)
def format_options_breakeven_line(
*,
expiry_be_px: float | None,
+1 -1
View File
@@ -380,4 +380,4 @@
</div>
</div>
<script src="/static/options_expiry_countdown.js?v=1"></script>
<script src="/static/options_panel.js?v=69"></script>
<script src="/static/options_panel.js?v=70"></script>