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:
@@ -257,3 +257,17 @@ def estimate_expiry_profit_at_index(
|
||||
else:
|
||||
return None
|
||||
return round((intrinsic - float(entry_px)) * float(eth_amount), 4)
|
||||
|
||||
|
||||
def equivalent_contract_leverage(
|
||||
*,
|
||||
index_px: float | None,
|
||||
eth_amount: float | None,
|
||||
total_premium: float | None,
|
||||
) -> float | None:
|
||||
"""名义价值 / 权利金,近似相当于永续合约杠杆倍数(测算用)。"""
|
||||
if index_px is None or eth_amount is None or total_premium is None:
|
||||
return None
|
||||
if eth_amount <= 0 or total_premium <= 0:
|
||||
return None
|
||||
return round(float(index_px) * float(eth_amount) / float(total_premium), 1)
|
||||
|
||||
Reference in New Issue
Block a user