From d5827b337e70d050836a8e1a20ef7bd09f1b5123 Mon Sep 17 00:00:00 2001 From: xxm Date: Tue, 25 Aug 2026 10:23:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20backfill=E8=A1=A5=E6=8E=A8=E5=90=8C?= =?UTF-8?q?=E8=A7=84=E5=88=99=E2=80=94=E2=80=94=E5=8F=AA=E6=8E=A8=E6=9C=89?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E5=BB=BA=E8=AE=AE=E4=BF=A1=E5=8F=B7=E7=9A=84?= =?UTF-8?q?=E8=B5=B0push=5Frecommend=5Falert=E6=A0=87=E5=87=86=E9=80=9A?= =?UTF-8?q?=E9=81=93,=E8=A7=82=E6=9C=9B/=E5=85=B3=E6=B3=A8=E5=8F=AA?= =?UTF-8?q?=E5=BD=92=E6=A1=A3broadcast(=E5=90=8C281922ac=E8=A7=84=E5=88=99?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../promote_reassess_backfill.py | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/deploy/profile-scripts/promote_reassess_backfill.py b/deploy/profile-scripts/promote_reassess_backfill.py index 4b1a6185..003f6c48 100644 --- a/deploy/profile-scripts/promote_reassess_backfill.py +++ b/deploy/profile-scripts/promote_reassess_backfill.py @@ -74,19 +74,23 @@ def main(wait_sec=90): f"WHERE status='active' AND code IN ({codes})", tuple(c[0] for c in backfilled)).fetchall() conn.close() - body = f"📤 重评报告补推({len(ready)}只新入自选的重评已就绪)\n" - for i, (code, name, strat, rr, fa) in enumerate(ready, 1): - nm = name or code - body += f"\n━━━ [{i}] {code} {nm} ━━━\n" - body += f"策略: {strat or 'unknown'} | RR: {rr or 'N/A'}\n" - if fa and len(str(fa)) > 50: - body += f"【12维重评】\n{fa}\n" - else: - body += "(仍未能生成,已放弃补推)\n" - if len(body) > 6000: - body = body[:6000] + "\n…(内容过长已截断)" - ok = xmpp_push(body) - print(f"[BACKFILL] 补推{'成功' if ok else '失败'}: {len(ready)} 只", flush=True) + # 2026-08-25 老莫新规则:只推有操作建议信号的,单只标准通道(门禁+12维全文), + # 观望/关注不推XMPP只归档broadcast + _ACTION_SIG = ("买入", "可买入", "可加仓") + pushed = 0 + conn2 = sqlite3.connect(DB, timeout=30) + for code, name, strat, rr, fa in ready: + tsig = conn2.execute( + "SELECT timing_signal FROM holding_strategies WHERE code=? AND status='active'", (code,)).fetchone() + if tsig and any(s in str(tsig[0] or "") for s in _ACTION_SIG): + try: + from mofin_db import push_recommend_alert + if push_recommend_alert(conn2, code): + pushed += 1 + except Exception as e: + print(f" ⚠️ {code} 补推失败: {e}", flush=True) + conn2.close() + print(f"[BACKFILL] 补推完成: {pushed}只有操作建议已推XMPP,其余仅归档broadcast", flush=True) if __name__ == "__main__": wait = int(sys.argv[1]) if len(sys.argv) > 1 else 90