diff --git a/deploy/profile-scripts/anomaly_monitor.py b/deploy/profile-scripts/anomaly_monitor.py index 8024f455..df020e5a 100644 --- a/deploy/profile-scripts/anomaly_monitor.py +++ b/deploy/profile-scripts/anomaly_monitor.py @@ -80,7 +80,7 @@ def get_holdings(): codes = set(h[0] for h in holds) | set(w[0] for w in wl) names = {h[0]: h[1] or h[0] for h in holds} names.update({w[0]: w[1] or w[0] for w in wl}) - costs = {h[0]: h[2] for h in holds} + costs = {h[0]: h[3] for h in holds} # 2026-08-24 修复列错位:h[2]=shares h[3]=cost(518880成本2400 bug) return codes, names, costs def check_anomalies(): diff --git a/deploy/profile-scripts/mofin_db.py b/deploy/profile-scripts/mofin_db.py index f82de1d8..d10776e3 100644 --- a/deploy/profile-scripts/mofin_db.py +++ b/deploy/profile-scripts/mofin_db.py @@ -1962,6 +1962,10 @@ def push_recommend_alert(conn, code: str): """推荐操作 XMPP 推送(tag 转为 current_recommend 时调用,全路径统一)。 质量门禁:实时价>0、区间有效(下沿<上沿<下沿x3)、现价不超上沿5%、 损<下沿且在(0.5x~1.0x)现价内、盈>上沿>损。不过不推。""" + try: + from alert_helper import notify, ACTION # 2026-08-24 修复 name 'notify' is not defined + except Exception: + notify, ACTION = None, "ACTION" try: row = conn.execute( "SELECT name, timing_signal, entry_low, entry_high, stop_loss, take_profit, " diff --git a/deploy/profile-scripts/price_monitor.py b/deploy/profile-scripts/price_monitor.py index 21b2a94d..5383fbef 100644 --- a/deploy/profile-scripts/price_monitor.py +++ b/deploy/profile-scripts/price_monitor.py @@ -199,16 +199,21 @@ def push_to_xmpp(text): # ACTION: 破止损/重评确认的操作信号 — 直通不限速 # INFO: 未确认的进区提示 — 聚合成摘要,30min 限 1 条 def _push_action(category, text): - # 统一消息处理者:操作推荐→broadcast归档+xmpp推送 + # 2026-08-24 老莫新规则:只有含"操作建议"的消息才上 XMPP(操作信号/推荐); + # 无操作建议的异动播报/止损告警/急跌告警只进 broadcast,不打扰 + _XMPP_CATS = ("操作信号", "重点推荐", "推荐操作") + _is_advice = category in _XMPP_CATS try: - messenger_send(title=f"MoFin持仓异动", content=text, source="price_monitor.py") + messenger_send(title=f"MoFin持仓异动", content=text, source="price_monitor.py", + channel="xmpp" if _is_advice else "broadcast") except Exception as e: print(f"[messenger失败] {e}", file=sys.stderr) - try: - from alert_helper import notify, ACTION - notify(category, text, ACTION) - except Exception as e: - print(f"[ACTION推送失败] {e}", file=sys.stderr) + if _is_advice: + try: + from alert_helper import notify, ACTION + notify(category, text, ACTION) + except Exception as e: + print(f"[ACTION推送失败] {e}", file=sys.stderr) def _push_digest(category, text): diff --git a/deploy/profile-scripts/strategy_lifecycle.py b/deploy/profile-scripts/strategy_lifecycle.py index 7a63297f..c5d88353 100644 --- a/deploy/profile-scripts/strategy_lifecycle.py +++ b/deploy/profile-scripts/strategy_lifecycle.py @@ -1584,11 +1584,11 @@ def reassess_strategy(code, name, price, cost, shares, current_action, else: action_parts.append("盈利良好") - if action_note: + if action_note and action_note not in action_parts: # 2026-08-24 判重:深套持有|深套持有 重复 action_parts.append(action_note) # 量价分析描述(如有,注入action) - if vol_pattern_note: + if vol_pattern_note and vol_pattern_note not in action_parts: action_parts.append(vol_pattern_note) if is_watchlist: