更新后端板块数据路由和服务(预提交)
This commit is contained in:
@@ -245,3 +245,19 @@ async def stock_fund_flow(
|
||||
"negativeDays": negative,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@router.get("/mx-tool", summary="MX 通用金融数据查询")
|
||||
async def mx_tool(
|
||||
query: str = Query(..., description="自然语言问句,如:「格力电器2024年净利润」「沪深300最新收盘价」「市盈率最低的50只股票」"),
|
||||
):
|
||||
"""通过 MX 妙想 API 查询任意金融数据(A股/港股/美股/基金/债券/指数/板块/宏观/新闻/公告/选股等)
|
||||
|
||||
单次查询最多支持 20 只证券。返回原始结构化表格(sheetName + columns + items)。
|
||||
"""
|
||||
if not query or not query.strip():
|
||||
raise HTTPException(status_code=400, detail="查询内容不能为空")
|
||||
data = await eastmoney.fetch_mx_tool(query.strip())
|
||||
if not data:
|
||||
raise HTTPException(status_code=404, detail="MX 查询无结果或所有 API Key 已耗尽")
|
||||
return {"data": data}
|
||||
|
||||
Reference in New Issue
Block a user