feat: AI分析第二档——get_news消息面、板块主力资金流TOPS、两融余额、截断续写机制
This commit is contained in:
@@ -17,7 +17,7 @@ from datetime import datetime, timezone, timedelta
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
from services import fuyao_client
|
||||
from services import fuyao_client, market_extra
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -163,12 +163,16 @@ async def _build_dashboard() -> dict:
|
||||
anomaly_data,
|
||||
limit_ladder_data,
|
||||
skyrocket_data,
|
||||
sector_flow_data,
|
||||
margin_data,
|
||||
) = await asyncio.gather(
|
||||
fuyao_client.hot_stock_list("day"),
|
||||
fuyao_client.dragon_tiger_list("all"),
|
||||
fuyao_client.anomaly_analysis_list(["SHARP_RISE", "RAPID_RALLY", "LIMIT_UP"]),
|
||||
fuyao_client.limit_up_ladder(),
|
||||
fuyao_client.skyrocket_list("day"),
|
||||
market_extra.fetch_sector_fund_flow(),
|
||||
market_extra.fetch_margin_summary(),
|
||||
return_exceptions=True,
|
||||
)
|
||||
except Exception:
|
||||
@@ -177,6 +181,8 @@ async def _build_dashboard() -> dict:
|
||||
anomaly_data = {}
|
||||
limit_ladder_data = {}
|
||||
skyrocket_data = {}
|
||||
sector_flow_data = None
|
||||
margin_data = None
|
||||
|
||||
# ── 解析指数 ──
|
||||
indices = []
|
||||
@@ -291,6 +297,12 @@ async def _build_dashboard() -> dict:
|
||||
"auctionSignal": auction_signal,
|
||||
}
|
||||
|
||||
# 两融余额(交易所 T+1 披露),供看板展示、AI 分析与次日环比快照使用
|
||||
if isinstance(margin_data, dict):
|
||||
market_stats["marginBalanceYi"] = margin_data.get("balanceYi")
|
||||
market_stats["marginChangeYi"] = margin_data.get("changeYi")
|
||||
market_stats["marginDate"] = margin_data.get("date")
|
||||
|
||||
# ── 行业强度榜(使用行业指数真实涨幅) ──
|
||||
sector_strength = []
|
||||
industries = industry_catalog if isinstance(industry_catalog, list) else []
|
||||
@@ -552,6 +564,7 @@ async def _build_dashboard() -> dict:
|
||||
"marketStats": market_stats,
|
||||
"sectorStrength": sector_strength[:31],
|
||||
"conceptStrength": concept_strength[:10],
|
||||
"sectorFundFlow": sector_flow_data if isinstance(sector_flow_data, dict) else None,
|
||||
"events": events,
|
||||
"limitLadder": limit_ladder,
|
||||
"updateTime": datetime.now(BJT).strftime("%Y-%m-%d %H:%M:%S"),
|
||||
|
||||
Reference in New Issue
Block a user