From 20f12f9342726e7791718c459bb68138f734e142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=BE=AE?= Date: Thu, 9 Jul 2026 16:17:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20stale=5Fpush=5Fwlin=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E4=BB=8Eholding=5Fstrategies=E6=89=AB=E6=8F=8F=E5=8F=AF?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E4=BF=A1=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/stale_push_wlin.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/scripts/stale_push_wlin.py b/scripts/stale_push_wlin.py index 8a21b48b..4c76767b 100644 --- a/scripts/stale_push_wlin.py +++ b/scripts/stale_push_wlin.py @@ -476,6 +476,37 @@ def main(): deduped.append(item) all_candidates = deduped + # 补充:从holding_strategies直接扫描可操作的信号(弥补stale_detector遗漏) + try: + import sqlite3 as _sq3 + _db = _sq3.connect('/home/hmo/MoFin/data/mofin.db') + _actionable = _db.execute( + "SELECT hs.code, hs.name, lp.price, lp.change_pct, hs.entry_low, hs.entry_high, " + "hs.stop_loss, hs.take_profit, hs.rr_ratio, hs.timing_signal, hs.action, hs.tech_snapshot, hs.sector_context " + "FROM holding_strategies hs " + "LEFT JOIN live_prices lp ON hs.code = lp.code " + "WHERE hs.status='active' AND hs.timing_signal IN ('买入','可买入','可加仓') " + "AND hs.rr_ratio > 0 AND hs.stop_loss > 0 AND hs.take_profit > 0" + ).fetchall() + _db.close() + for row in _actionable: + code = str(row[0]) + if code in seen_codes: + continue + price = row[2] or 0 + el = row[4] or 0 + eh = row[5] or 0 + if price <= 0 or el <= 0 or eh <= 0: + continue + # 价格必须在买入区内或略高于(不超过5%) + if price > eh * 1.05: + continue + name = row[1] or code + all_candidates.append((name, code, price, el, eh, "", False)) + seen_codes.add(code) + except Exception: + pass + # 重建 stocks 列表,用新数据判断(不再用旧 is_stale 标记,因为已全部重评) stocks = [] zone_notes = [] # 在操作区间但不可操作→发说明