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

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
+8 -1
View File
@@ -349,6 +349,13 @@ def test_expiry_breakeven_coin_margin():
) == round(2425 / (1 - 0.0187), 2)
def test_strike_distance_to_be():
from lib.options.options_pricing_lib import strike_distance_to_be
assert strike_distance_to_be(2390, 2430, opt_type="C") == 40.0
assert strike_distance_to_be(2450, 2411, opt_type="P") == 39.0
def test_straddle_breakeven_band_coin():
from lib.options.options_pricing_lib import straddle_breakeven_band
@@ -454,4 +461,4 @@ def test_format_position_row_breakeven():
assert row["expiry_be_px"] == 3515.6
assert row["idx_px"] == 3480.0
assert row["close_be_px"] is not None
assert row["dist_expiry_be"] == 35.6
assert row["dist_expiry_be"] == 15.6