Fix dist-to-breakeven as strike-to-equilibrium spread.

Chain and order panel now show expiry_be minus strike instead of index distance.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-23 08:16:03 +08:00
parent 6d2d345b70
commit af3bc5f62a
2 changed files with 13 additions and 4 deletions
+8 -1
View File
@@ -519,12 +519,19 @@ def close_breakeven_idx(
def idx_distance_to_be(idx_px: float | None, be_px: float | None) -> float | None:
"""指数距平衡点(正=指数需上涨才到平衡点)."""
"""指数距平衡点(正=指数需上涨才到平衡点).用于平掉回本等随盘变化场景."""
if idx_px is None or be_px is None:
return None
return round(float(be_px) - float(idx_px), 2)
def strike_distance_to_be(strike: float | None, be_px: float | None) -> float | None:
"""行权价与到期平衡的价差(平衡价 - 行权价).链上「距平衡」列用此值."""
if strike is None or be_px is None:
return None
return round(float(be_px) - float(strike), 2)
def format_options_breakeven_line(
*,
expiry_be_px: float | None,