增加大模型

This commit is contained in:
dekun
2026-05-26 09:38:23 +08:00
parent e0ec3f87a9
commit 27031ab676
14 changed files with 797 additions and 69 deletions
+6 -15
View File
@@ -1,4 +1,4 @@
"""三日数据统计:连续三日 Top30 且 |涨跌|>=5%"""
"""三日数据统计:连续三日成交额 Top30 交集(不限制涨跌幅)"""
from typing import Any
@@ -15,7 +15,6 @@ def compute_three_day_stats() -> dict[str, Any]:
yesterday_snap = get_latest_snapshot("yesterday")
daybefore_snap = get_latest_snapshot("daybefore")
threshold = settings.change_threshold
top_n = settings.top_n
missing = []
@@ -31,7 +30,7 @@ def compute_three_day_stats() -> dict[str, Any]:
"ok": False,
"missing_periods": missing,
"message": f"缺少快照:{', '.join(missing)},请等待刷新或手动触发",
"criteria": _criteria_text(threshold, top_n),
"criteria": _criteria_text(top_n),
"count": 0,
"items": [],
"periods": _period_meta(today_snap, yesterday_snap, daybefore_snap),
@@ -46,12 +45,6 @@ def compute_three_day_stats() -> dict[str, Any]:
for sym in sorted(symbols):
t, y, b = today_map[sym], yesterday_map[sym], daybefore_map[sym]
if not (
abs(t.get("price_change_pct", 0)) >= threshold
and abs(y.get("price_change_pct", 0)) >= threshold
and abs(b.get("price_change_pct", 0)) >= threshold
):
continue
qualified.append(
{
"symbol": sym,
@@ -79,9 +72,10 @@ def compute_three_day_stats() -> dict[str, Any]:
return {
"ok": True,
"criteria": _criteria_text(threshold, top_n),
"criteria": _criteria_text(top_n),
"count": len(qualified),
"items": qualified,
"symbols": [q["symbol"] for q in qualified],
"periods": _period_meta(today_snap, yesterday_snap, daybefore_snap),
"summary": {
"today_top30": len(today_map),
@@ -92,11 +86,8 @@ def compute_three_day_stats() -> dict[str, Any]:
}
def _criteria_text(threshold: float, top_n: int) -> str:
return (
f"连续三日成交额 Top{top_n} 且每日 |涨跌幅| ≥ {threshold:g}%"
f"(今日/昨日/前日三个完整切日周期)"
)
def _criteria_text(top_n: int) -> str:
return f"连续三日成交额均位列 Top{top_n}(今日/昨日/前日交集,涨跌幅不限)"
def _pick_fields(row: dict) -> dict: