feat: all remaining Tencent API price fetchers now DB-first (8 files)

This commit is contained in:
知微
2026-07-01 22:59:17 +08:00
parent 0aef122b69
commit b2822cec15
4 changed files with 29 additions and 2 deletions
+8 -1
View File
@@ -55,7 +55,14 @@ def _market_prefix(code):
def get_quote(code):
"""获取腾讯API行情数据(带60秒缓存)"""
"""获取行情数据。DB 优先(price_monitor 维护),腾讯 API fallback"""
# DB 优先
try:
from mofin_db import get_price_from_db
p, chg = get_price_from_db(code)
if p: return {"code": code, "price": p, "change_pct": chg or 0}
except: pass
# Fallback: 腾讯 API
import time
_cache = get_quote.__dict__.get("_cache", {})
now = time.time()