feat: options sheet sizing, ITM/OTM labels, and 14-day chain view
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -45,6 +45,28 @@ def test_calc_order_size_budget():
|
||||
assert r["total_premium"] <= 10
|
||||
|
||||
|
||||
def test_calc_order_size_sheets():
|
||||
r = calc_order_size(
|
||||
quote_per_unit=15.6,
|
||||
ct_mult=0.01,
|
||||
min_sz=1,
|
||||
sheets=3,
|
||||
budget_cap=10,
|
||||
)
|
||||
assert r["ok"] is True
|
||||
assert r["sheets"] == 3
|
||||
assert abs(r["total_premium"] - 0.468) < 1e-9
|
||||
|
||||
|
||||
def test_option_moneyness():
|
||||
from lib.options.options_pricing_lib import option_moneyness, option_moneyness_label
|
||||
|
||||
assert option_moneyness(opt_type="C", strike=1700, index_px=1800) == "itm"
|
||||
assert option_moneyness(opt_type="C", strike=1900, index_px=1800) == "otm"
|
||||
assert option_moneyness_label("itm") == "实值"
|
||||
assert option_moneyness_label("otm") == "虚值"
|
||||
|
||||
|
||||
def test_calc_order_size_too_small():
|
||||
r = calc_order_size(
|
||||
quote_per_unit=2000.0,
|
||||
|
||||
Reference in New Issue
Block a user