refactor: 删除板块资金流向,题材板块功能更全
- 删除前端 /sectors 页面、首页入口按钮、stock-api 板块类型与 fetchSectors - 删除后端 /api/sectors 路由,main.py 移除注册 - eastmoney.py 移除板块数据段(_fetch_push2/_fetch_akshare/UT令牌管理), 清理重复 import 与无用 datetime 子导入 - mootdx.py 移除板块降级方案(fetch_sector_list) - routeTree.gen.ts 由 build 自动重新生成,移除 sectors 路由 题材热点/热点穿透/核心股已覆盖板块能力,功能更全,板块资金流向不再需要 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
通过 TCP 协议直连通达信行情服务器,不走 HTTP,不会被限流。
|
||||
主要用途:
|
||||
- K线数据:主数据源(稳定可靠)
|
||||
- 板块数据:东方财富 push2 的降级方案
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
@@ -69,60 +68,3 @@ async def fetch_kline_history(code: str, days: int = 90) -> Optional[List[dict]]
|
||||
except Exception as e:
|
||||
print(f"[mootdx] fetch_kline error: {e}")
|
||||
return None
|
||||
|
||||
|
||||
# ---- 板块数据(东方财富降级方案)----
|
||||
|
||||
|
||||
def _sync_fetch_sectors(sector_type: str) -> Optional[list]:
|
||||
from mootdx.consts import MARKET_SH, MARKET_SZ
|
||||
|
||||
client = _create_client()
|
||||
|
||||
# block() 返回 DataFrame,列:code, name 等
|
||||
# 按板块类型过滤
|
||||
block_df = client.block()
|
||||
if block_df is None or block_df.empty:
|
||||
return None
|
||||
|
||||
items = []
|
||||
for _, row in block_df.iterrows():
|
||||
name = str(row.get("name", "") or row.get("blockname", ""))
|
||||
code = str(row.get("code", "") or row.get("blockcode", ""))
|
||||
if not code or not name:
|
||||
continue
|
||||
|
||||
items.append(
|
||||
{
|
||||
"code": code,
|
||||
"name": name,
|
||||
"level": None,
|
||||
"changePercent": None,
|
||||
"changeAmount": None,
|
||||
"mainNetInflow": 0,
|
||||
"mainNetInflowPercent": None,
|
||||
"superLargeInflow": None,
|
||||
"superLargeInflowPercent": None,
|
||||
"largeInflow": None,
|
||||
"largeInflowPercent": None,
|
||||
"mediumInflow": None,
|
||||
"mediumInflowPercent": None,
|
||||
"smallInflow": None,
|
||||
"smallInflowPercent": None,
|
||||
"turnover": 0,
|
||||
}
|
||||
)
|
||||
|
||||
return items if items else None
|
||||
|
||||
|
||||
async def fetch_sector_list(sector_type: str) -> Optional[List[dict]]:
|
||||
"""获取板块列表(东方财富的降级方案,仅含代码和名称)"""
|
||||
try:
|
||||
loop = asyncio.get_event_loop()
|
||||
return await loop.run_in_executor(None, _sync_fetch_sectors, sector_type)
|
||||
except ImportError:
|
||||
return None
|
||||
except Exception as e:
|
||||
print(f"[mootdx] fetch_sectors error: {e}")
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user