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