K线数据首选mootdx通达信TCP源,板块数据增加mootdx降级

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Sakurasan
2026-07-08 02:09:57 +08:00
co-authored by Claude Opus 4.7
parent 015aeb989a
commit 86535f5de2
4 changed files with 151 additions and 7 deletions
+10 -2
View File
@@ -1,7 +1,7 @@
"""板块数据路由:行业板块、概念板块"""
from fastapi import APIRouter, Query, HTTPException
from services import eastmoney
from services import eastmoney, mootdx
router = APIRouter()
@@ -14,4 +14,12 @@ async def sector_list(
raise HTTPException(status_code=400, detail="板块类型错误,仅支持 industry/concept")
data = await eastmoney.fetch_sector_list(type)
return {"data": data, "count": len(data), "type": type}
if data:
return {"data": data, "count": len(data), "type": type}
# 降级:通达信 mootdx(不含实时资金流数据)
md_data = await mootdx.fetch_sector_list(type)
if md_data:
return {"data": md_data, "count": len(md_data), "type": type, "source": "mootdx"}
return {"data": [], "count": 0, "type": type}