Fetch option Delta from OKX opt-summary into the chain.
market/tickers has no greeks; merge public/opt-summary delta/gamma when building the strike table. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -165,3 +165,20 @@ def fetch_option_tickers_public(inst_family: str) -> dict[str, dict[str, Any]]:
|
||||
if isinstance(r, dict) and r.get("instId"):
|
||||
out[str(r["instId"])] = r
|
||||
return out
|
||||
|
||||
|
||||
def fetch_option_summary_public(inst_family: str) -> dict[str, dict[str, Any]]:
|
||||
"""期权摘要(含 delta/gamma 等);market/tickers 不含希腊字母."""
|
||||
family = str(inst_family or "").strip()
|
||||
if not family:
|
||||
return {}
|
||||
payload = okx_public_get(
|
||||
"/api/v5/public/opt-summary",
|
||||
{"instFamily": family},
|
||||
timeout_sec=12.0,
|
||||
)
|
||||
out: dict[str, dict[str, Any]] = {}
|
||||
for r in payload.get("data") or []:
|
||||
if isinstance(r, dict) and r.get("instId"):
|
||||
out[str(r["instId"])] = r
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user