From 0ad793d18756ff79af66c65bc450128e000ffa26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=BE=AE?= Date: Thu, 9 Jul 2026 11:00:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20generate=5Freport.py=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=B1=82=E5=BC=BA=E5=88=B6=E5=89=8D=E7=BD=AE=E9=87=8D=E8=AF=84?= =?UTF-8?q?(LLM=E6=97=A0=E6=B3=95=E8=B7=B3=E8=BF=87)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/generate_report.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/generate_report.py b/scripts/generate_report.py index cc85326a..74ae17b9 100644 --- a/scripts/generate_report.py +++ b/scripts/generate_report.py @@ -94,6 +94,26 @@ def build_sections(data) -> dict: def main(): report_type = sys.argv[1] if len(sys.argv) > 1 else "intraday_monitor" + # ★ 前置重评:对 holding_strategies 中信号为买入/卖出的股票,先触发重评 + try: + import sqlite3 + _conn = sqlite3.connect(str(SCRIPTS_DIR.parent / "data" / "mofin.db")) + _actionable = _conn.execute( + "SELECT code FROM holding_strategies WHERE status='active' " + "AND timing_signal IN ('买入','可买入','可加仓','卖出','止盈')" + ).fetchall() + _conn.close() + for (_code,) in _actionable: + try: + subprocess.run( + ["python3", str(SCRIPTS_DIR / "per_stock_reassess.py"), _code], + capture_output=True, timeout=30 + ) + except: + pass + except Exception: + pass + data = get_report_data() sections = build_sections(data)