fix: exchange-specific volume rank APIs for OKX and full top20
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -381,14 +381,18 @@ def _refresh_volume_ranks(*, force: bool = False) -> dict:
|
||||
if not ex_key or not ex.get("enabled"):
|
||||
continue
|
||||
resp = _fetch_instance_volume_rank_sync(ex, top_n=TOP_N_DEFAULT)
|
||||
if resp.get("ok"):
|
||||
if resp.get("ok") and resp.get("items"):
|
||||
cache = merge_exchange_rank(cache, ex_key, resp)
|
||||
else:
|
||||
msg = str(resp.get("msg") or resp.get("error") or "拉取失败")
|
||||
if resp.get("ok") and not resp.get("items"):
|
||||
msg = msg if msg != "拉取失败" else "无有效成交额数据"
|
||||
errors.append(f"{ex_key}:{msg}")
|
||||
exchanges = dict(cache.get("exchanges") or {})
|
||||
prev = dict(exchanges.get(ex_key) or {})
|
||||
prev["error"] = msg
|
||||
if not prev.get("items"):
|
||||
prev["items"] = []
|
||||
exchanges[ex_key] = prev
|
||||
cache["exchanges"] = exchanges
|
||||
cache["rank_date"] = expected
|
||||
|
||||
Reference in New Issue
Block a user