Show equivalent contract leverage on options order panel.

Display notional-over-premium leverage at current index and at the user target price for quick sizing comparison.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-07 16:58:25 +08:00
parent 27921213b0
commit 25879dd007
4 changed files with 79 additions and 20 deletions
+8
View File
@@ -67,6 +67,14 @@ def test_option_moneyness():
assert option_moneyness_label("otm") == "虚值"
def test_equivalent_contract_leverage():
from lib.options.options_pricing_lib import equivalent_contract_leverage
# index 1768, 0.2 ETH, premium 2.44 -> ~144.9x
lev = equivalent_contract_leverage(index_px=1768, eth_amount=0.2, total_premium=2.44)
assert lev == 144.9
def test_estimate_expiry_profit_at_index():
from lib.options.options_pricing_lib import estimate_expiry_profit_at_index