From 72885bcf45dd634709ae067eceb6e3f75e27b8aa Mon Sep 17 00:00:00 2001 From: hmo Date: Tue, 28 Jul 2026 09:52:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20generate=5Freport=20DB=E8=B7=AF=E5=BE=84?= =?UTF-8?q?+status=E8=BF=87=E6=BB=A4+MAX=5FPRE=5FREASSESS=E9=98=B2?= =?UTF-8?q?=E8=B6=85=E6=97=B6(=E8=BF=98=E5=8E=9F=E7=9F=A5=E5=BE=AE?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/profile-scripts/generate_report.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/deploy/profile-scripts/generate_report.py b/deploy/profile-scripts/generate_report.py index 0ee6b445..63e68b3a 100644 --- a/deploy/profile-scripts/generate_report.py +++ b/deploy/profile-scripts/generate_report.py @@ -97,15 +97,16 @@ def main(): # ★ 前置重评:对 holding_strategies 中信号为买入/卖出的股票,先触发重评 try: import sqlite3 - _conn = sqlite3.connect(str(SCRIPTS_DIR.parent / "data" / "mofin.db")) + _conn = sqlite3.connect("/home/hmo/web-dashboard/data/mofin.db") _actionable = _conn.execute( "SELECT hs.code, lp.price, hs.entry_low, hs.entry_high FROM holding_strategies hs " "LEFT JOIN live_prices lp ON hs.code = lp.code " - "WHERE hs.status='active' " + "WHERE hs.status LIKE '%active%' " "AND hs.timing_signal IN ('买入','可买入','可加仓','卖出','止盈')" ).fetchall() _conn.close() - for _code, _price, _el, _eh in _actionable: + MAX_PRE_REASSESS = 5 + for _code, _price, _el, _eh in _actionable[:MAX_PRE_REASSESS]: # 价格必须在买入区内或附近(不高于上沿20%),否则不触发重评 if _price and _el and _eh and _price > 0 and _el > 0 and _eh > 0: if _price > _eh * 1.20: @@ -114,7 +115,7 @@ def main(): try: subprocess.run( ["python3", str(SCRIPTS_DIR / "per_stock_reassess.py"), _code], - capture_output=True, timeout=30 + capture_output=True, timeout=15 ) except: pass