2ee00f8016
AI 解读字段扩展:
- 新增 taf_read_zh/en:解读机场预报中影响今日峰值窗口的变化
- 新增 probability_read_zh/en:描述概率分布形态(最高桶、偏左/偏右)
- stream max_tokens 900→1200 容纳新输出字段
- 缓存 key 简化为 METAR原文+观测时间,大幅提升命中率
- 兜底函数补全 TAF 和概率字段的确定性生成
异常检测:
- 纯数学计算,零 AI 延迟:实测温度 vs 全部模型预测上下限
- 三级告警:breakout_above / breakout_below / deviation
市场概览:
- 新增 POST /api/scan/terminal/overview(MiMo 批量解读,缓存10分钟)
- 前端 MarketOverviewBanner 可折叠横幅(顶栏与标签栏之间)
- 移动端适配 640px/768px 断点,暗色/亮色双主题
Scope-risk: MEDIUM — 170 测试通过,TypeScript 零错误,ruff 零告警
Tested: python -m pytest -q (170 passed), npx tsc --noEmit (0 errors), ruff check .
63 lines
1.7 KiB
Python
63 lines
1.7 KiB
Python
"""Market scan and scan AI API routes."""
|
|
|
|
from fastapi import APIRouter, Request
|
|
|
|
from web.services.scan_api import (
|
|
get_scan_city_ai_forecast_payload,
|
|
get_scan_city_ai_stream_response,
|
|
get_scan_terminal_ai_payload,
|
|
get_scan_terminal_overview_payload,
|
|
get_scan_terminal_payload,
|
|
)
|
|
|
|
router = APIRouter(tags=["scan"])
|
|
|
|
|
|
@router.get("/api/scan/terminal")
|
|
async def scan_terminal(
|
|
request: Request,
|
|
scan_mode: str = "tradable",
|
|
min_price: float = 0.05,
|
|
max_price: float = 0.95,
|
|
min_edge_pct: float = 2.0,
|
|
min_liquidity: float = 500.0,
|
|
high_liquidity_only: bool = False,
|
|
market_type: str = "maxtemp",
|
|
time_range: str = "today",
|
|
limit: int = 25,
|
|
force_refresh: bool = False,
|
|
):
|
|
return await get_scan_terminal_payload(
|
|
request,
|
|
scan_mode=scan_mode,
|
|
min_price=min_price,
|
|
max_price=max_price,
|
|
min_edge_pct=min_edge_pct,
|
|
min_liquidity=min_liquidity,
|
|
high_liquidity_only=high_liquidity_only,
|
|
market_type=market_type,
|
|
time_range=time_range,
|
|
limit=limit,
|
|
force_refresh=force_refresh,
|
|
)
|
|
|
|
|
|
@router.post("/api/scan/terminal/ai")
|
|
async def scan_terminal_ai(request: Request):
|
|
return await get_scan_terminal_ai_payload(request)
|
|
|
|
|
|
@router.post("/api/scan/terminal/ai-city")
|
|
async def scan_terminal_ai_city(request: Request):
|
|
return await get_scan_city_ai_forecast_payload(request)
|
|
|
|
|
|
@router.post("/api/scan/terminal/ai-city/stream")
|
|
async def scan_terminal_ai_city_stream(request: Request):
|
|
return await get_scan_city_ai_stream_response(request)
|
|
|
|
|
|
@router.post("/api/scan/terminal/overview")
|
|
async def scan_terminal_overview(request: Request):
|
|
return await get_scan_terminal_overview_payload(request)
|