Files
2026-08-01 10:33:19 +08:00

15 lines
442 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""杠杆口径 v1:杠杆 = 标的指数 ÷ 期权卖一(ask)。"""
from __future__ import annotations
LEVERAGE_FORMULA_VERSION = "1.0"
def option_leverage(index_px: float, ask: float | None) -> float | None:
"""index_px / askask 无效时返回 None。"""
if index_px is None or index_px <= 0:
return None
if ask is None or ask <= 0:
return None
return float(index_px) / float(ask)