From c48429b9942d2cb4136ae0106009f9c3cdfa6317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=BE=AE?= Date: Fri, 10 Jul 2026 11:30:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=95=E6=97=A5=E6=9A=B4=E8=B7=8C>7%?= =?UTF-8?q?=E5=AE=9E=E6=97=B6=E5=91=8A=E8=AD=A6(=E4=B8=8D=E4=BE=9D?= =?UTF-8?q?=E8=B5=96zone=E8=BE=B9=E7=95=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/price_monitor.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/scripts/price_monitor.py b/scripts/price_monitor.py index df7dac6b..b59fb122 100644 --- a/scripts/price_monitor.py +++ b/scripts/price_monitor.py @@ -452,6 +452,35 @@ def run_once(round_label=""): # === 第三步:买入区偏离检测 + 自动重评 === reassesed_codes = [] + # 先做急跌检测(所有持仓,不依赖买入区) + for d in active: + code = d["code"] + name = d.get("name", code) + price_info = prices.get(code) + if not price_info: + continue + price, _, change_pct = price_info + if price == 0: + continue + # 单日跌幅>7%告警(不依赖zone边界,盘中急跌即触发) + try: + cp = float(change_pct) if change_pct else 0 + except: + cp = 0 + if cp <= -7: + prev_alert = state.get(code, {}).get("__sharp_decline_triggered", False) + if not prev_alert: + stop_loss = d.get("stop_loss", 0) + sl_note = f" 止损{stop_loss}" if stop_loss else "" + msg = f"🔻 {name}({code}) {price} 暴跌{cp:.1f}%!{sl_note}" + push_to_xmpp(msg) + outputs.append(msg) + state.setdefault(code, {})["__sharp_decline_triggered"] = True + state_updated = True + elif cp > -5: + # 反弹后清除告警标记,下次再跌还能报 + state.setdefault(code, {}).pop("__sharp_decline_triggered", None) + for d in active: code = d["code"] name = d.get("name", code)