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:
dekun
2026-10-14 22:02:25 +08:00
parent 37428c0bf9
commit 1d8c38e320
3 changed files with 47 additions and 2 deletions
+17
View File
@@ -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