first commit
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
"""杠杆口径 v1:杠杆 = 标的指数 ÷ 期权卖一(ask)。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
LEVERAGE_FORMULA_VERSION = "1.0"
|
||||
|
||||
|
||||
def option_leverage(index_px: float, ask: float | None) -> float | None:
|
||||
"""index_px / ask;ask 无效时返回 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)
|
||||
Reference in New Issue
Block a user