diff --git a/lib/exchange/okx_options_lib.py b/lib/exchange/okx_options_lib.py
index 8c38878..59a13a1 100644
--- a/lib/exchange/okx_options_lib.py
+++ b/lib/exchange/okx_options_lib.py
@@ -841,6 +841,27 @@ def fetch_option_tickers(ex: ccxt.okx, inst_family: str) -> dict[str, dict[str,
return out
+def fetch_option_summary(ex: ccxt.okx, inst_family: str) -> dict[str, dict[str, Any]]:
+ """期权希腊字母摘要(delta/gamma);tickers 接口无此字段."""
+ out: dict[str, dict[str, Any]] = {}
+ try:
+ from lib.exchange.okx_public_http_lib import fetch_option_summary_public
+
+ got = fetch_option_summary_public(inst_family)
+ if got:
+ return got
+ except Exception:
+ pass
+ try:
+ rows = ex.public_get_public_opt_summary({"instFamily": inst_family}).get("data") or []
+ for r in rows:
+ if isinstance(r, dict) and r.get("instId"):
+ out[str(r["instId"])] = r
+ except Exception:
+ pass
+ return out
+
+
def build_option_chain(
ex: ccxt.okx,
underlying: str,
@@ -890,6 +911,8 @@ def build_option_chain(
except Exception as e2:
instruments_err = str(e2) or e2.__class__.__name__
tickers = fetch_option_tickers(ex, family)
+ # 希腊字母在 opt-summary,不在 market/tickers
+ summaries = fetch_option_summary(ex, family)
expiries: dict[str, list[dict[str, Any]]] = {}
skipped_no_index = 0
for meta in instruments:
@@ -914,7 +937,12 @@ def build_option_chain(
):
continue
inst_id = str(meta.get("instId") or "")
- t = tickers.get(inst_id) or {}
+ t = dict(tickers.get(inst_id) or {})
+ sm = summaries.get(inst_id) or {}
+ # 合并摘要里的 delta/gamma(优先币本位 delta,回退 deltaBS)
+ for k in ("delta", "deltaBS", "gamma", "gammaBS", "lever", "markVol"):
+ if sm.get(k) not in (None, ""):
+ t[k] = sm.get(k)
q = _resolve_chain_quote(
ticker=t,
meta=meta,
diff --git a/lib/exchange/okx_public_http_lib.py b/lib/exchange/okx_public_http_lib.py
index 3ed0af9..6a402be 100644
--- a/lib/exchange/okx_public_http_lib.py
+++ b/lib/exchange/okx_public_http_lib.py
@@ -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
diff --git a/lib/hedge_plan/templates/hedge_plan_panel.html b/lib/hedge_plan/templates/hedge_plan_panel.html
index d83d035..ae6ea4e 100644
--- a/lib/hedge_plan/templates/hedge_plan_panel.html
+++ b/lib/hedge_plan/templates/hedge_plan_panel.html
@@ -509,4 +509,4 @@
-
+