Add T-shaped options chain view with straddle metrics (phase A).
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -75,6 +75,23 @@ def test_equivalent_contract_leverage():
|
||||
assert lev == 144.9
|
||||
|
||||
|
||||
def test_straddle_pricing():
|
||||
from lib.options.options_pricing_lib import (
|
||||
format_straddle_band,
|
||||
straddle_ask_per_unit,
|
||||
straddle_breakeven_band,
|
||||
straddle_premium_total,
|
||||
)
|
||||
|
||||
assert straddle_ask_per_unit(0.148, 16.2) == 16.348
|
||||
assert straddle_premium_total(0.148, 16.2, 1.0) == 16.35
|
||||
lo, hi = straddle_breakeven_band(1800, 16.348)
|
||||
assert lo == 1783.65
|
||||
assert hi == 1816.35
|
||||
assert format_straddle_band(1800, 16.348) == "1784 ~ 1816"
|
||||
assert straddle_ask_per_unit(0.148, None) is None
|
||||
|
||||
|
||||
def test_estimate_expiry_value_and_profit_at_index():
|
||||
from lib.options.options_pricing_lib import (
|
||||
estimate_expiry_profit_at_index,
|
||||
|
||||
Reference in New Issue
Block a user