概念/行业分析添加日期选择功能
- backend: market_snapshot 支持可选 as_of 参数 - frontend: 两页加 DatePicker,按选定日期查询数据 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -296,13 +296,14 @@ def get_cached(
|
||||
|
||||
|
||||
@router.get("/market-snapshot")
|
||||
def market_snapshot(request: Request):
|
||||
"""最新全市场轻量行情快照,供板块/概念聚合分析使用。"""
|
||||
def market_snapshot(request: Request, as_of: date | None = None):
|
||||
"""全市场轻量行情快照(可选指定日期),供板块/概念聚合分析使用。"""
|
||||
import polars as pl
|
||||
|
||||
repo = request.app.state.repo
|
||||
svc = ScreenerService(repo)
|
||||
as_of = svc.latest_date()
|
||||
if as_of is None:
|
||||
as_of = svc.latest_date()
|
||||
if not as_of:
|
||||
return {"as_of": None, "rows": []}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user