mirror of
https://ghfast.top/https://github.com/aeroxw/tick-stock-panel.git
synced 2026-09-12 21:24:16 +08:00
- abnormal_moves 新增 build_intraday: enriched 七类当日信号聚合, 优先级(涨停>炸板>翘板>跌停>新高>新低>放量)+涨跌幅排序, GET /api/abnormal/intraday - 维度排名项携带 group_source 与 source_field(configId.field), 前端可精确判定概念/行业而非字符串包含 - ext_data 新增 dimension-intraday: 成分股×当日分钟分区等权聚合, prev_close 优先/首根退化基准、成分网格化 ffill、全市场对照线, 小数制涨跌幅契约、60s 进程内缓存、点击触发不预计算 - 板块分时 7 测 + 盘中异动 4 测
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
"""异动监控 API — 竞价/盘中/偏移三类异动。
|
|
|
|
- /intraday: 盘中量价信号聚合 (enriched 当日信号列, 零新增采集)
|
|
- /overview: 偏移异动边缘总览 (交易所异动规则口径的接近度)
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from fastapi import APIRouter, Query, Request
|
|
|
|
from app.services.abnormal_moves import build_intraday, build_overview
|
|
|
|
router = APIRouter(prefix="/api/abnormal", tags=["abnormal"])
|
|
|
|
|
|
@router.get("/intraday")
|
|
def abnormal_intraday(
|
|
request: Request,
|
|
limit: int = Query(500, ge=1, le=2000),
|
|
):
|
|
"""盘中异动: 涨停/炸板/跌停翘板/跌停/新高/新低/放量 信号命中行。"""
|
|
repo = request.app.state.repo
|
|
return build_intraday(repo, limit=limit)
|
|
|
|
|
|
@router.get("/overview")
|
|
def abnormal_overview(
|
|
request: Request,
|
|
min_closeness: float = Query(0.5, ge=0.0, le=1.0),
|
|
limit: int = Query(200, ge=1, le=1000),
|
|
):
|
|
"""异动边缘总览: 规则表 + 各窗口实时偏离 + 接近度排序。
|
|
|
|
min_closeness: 0.5=观察 / 0.7=边缘 / 1.0=已触发。
|
|
"""
|
|
repo = request.app.state.repo
|
|
quote_service = getattr(request.app.state, "quote_service", None)
|
|
return build_overview(repo, quote_service, min_closeness=min_closeness, limit=limit)
|