fix(HEL-494): 数据中枢独占调度,主网站不再回退旧接口

主网站只向中枢要业务数据;来源选择、切源、补数全部在中枢内部完成,失败不再走东财/腾讯/Tushare 保底。

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
总工
2026-09-08 21:43:31 +08:00
co-authored by Cursor multica-agent
parent ef13d6feb5
commit 0b8419abca
23 changed files with 1159 additions and 368 deletions
+5 -38
View File
@@ -618,27 +618,19 @@ class ShenwanIndustryMixin:
trade_date: str,
finalized: bool = False,
) -> tuple[dict[str, Any], str, str]:
aggregator = getattr(self, "realtime_aggregator", None)
loader = getattr(aggregator, "eastmoney_shenwan_quote", None) if aggregator else None
if callable(loader):
hub = getattr(self, "try_sector_quote", None)
if callable(hub):
try:
row = loader(sector_code, expected_date="" if finalized else trade_date)
row = hub(sector_code, "" if finalized else trade_date)
except Exception as exc:
message = str(exc)
if finalized:
return {}, "", f"申万行业 {sector_code} 盘后正式数据待入库"
return {}, "", f"免费申万实时暂不可用:{message[:180]}"
return {}, "", f"数据中枢申万实时暂不可用:{message[:180]}"
if row:
return dict(row), str(row.get("source") or "eastmoney_sw"), ""
return dict(row), str(row.get("source") or "datahub"), ""
if finalized:
return {}, "", f"申万行业 {sector_code} 当日盘后正式数据尚未入库"
if aggregator and sector_name:
try:
row = aggregator.eastmoney_sector(sector_name)
except Exception as exc:
return {}, "", f"免费行业实时暂不可用:{str(exc)[:180]}"
if row:
return dict(row), str(row.get("source") or "eastmoney_sector"), ""
return {}, "", f"申万行业 {sector_code} 当日外显待补充"
def _load_member_realtime_quotes(
@@ -677,31 +669,6 @@ class ShenwanIndustryMixin:
delayed = any(item.get("delayed") for item in filtered)
return filtered, "datahub_delayed" if delayed else "datahub"
aggregator = getattr(self, "realtime_aggregator", None)
eastmoney_loader = getattr(aggregator, "eastmoney_stock_quotes", None) if aggregator else None
if callable(eastmoney_loader):
try:
filtered = consider(eastmoney_loader(wanted, expected_date=trade_date) or [], "eastmoney_ulist")
if len(filtered) >= max(1, int(len(wanted) * 0.9)):
return filtered, "eastmoney_ulist"
except Exception:
pass
tencent_loader = getattr(aggregator, "tencent_stock_quotes", None) if aggregator else None
if callable(tencent_loader):
try:
filtered = consider(tencent_loader(wanted, expected_date=trade_date) or [], "tencent_qt")
if len(filtered) >= max(1, int(len(wanted) * 0.9)):
return filtered, "tencent_qt"
except Exception:
pass
try:
quotes, source = self._free_realtime_quotes(trade_date, ",".join(wanted))
consider(quotes, source)
except TushareError:
pass
if best_rows:
delayed = any(item.get("delayed") for item in best_rows)
if delayed and not str(best_source).endswith("_delayed"):