feat: mofin_db get_price_from_db/get_prices_batch helpers + strategy_evaluator DB-first
This commit is contained in:
+13
-1
@@ -44,9 +44,21 @@ def save_json(path, data):
|
||||
|
||||
|
||||
def fetch_prices(codes):
|
||||
"""批量拉腾讯行情"""
|
||||
"""批量拉价格。DB 优先(price_monitor 维护),腾讯 API fallback"""
|
||||
if not codes:
|
||||
return {}
|
||||
|
||||
# 主通道: DB
|
||||
try:
|
||||
from mofin_db import get_prices_batch_from_db
|
||||
db_results = get_prices_batch_from_db(codes)
|
||||
if db_results:
|
||||
return {code: {"name": "", "price": p, "prev_close": 0, "change_pct": chg or 0,
|
||||
"high": 0, "low": 0} for code, (p, chg) in db_results.items()}
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Fallback: 腾讯 API
|
||||
symbols = []
|
||||
code_map = {}
|
||||
for c in codes:
|
||||
|
||||
Reference in New Issue
Block a user