fix: 推荐链路+消息路由5修——①push_recommend_alert notify未导入(推荐推送全灭根因)②action判重(深套持有重复)③518880成本列错位h[2]shares→h[3]cost④_push_action分类路由:操作信号才上XMPP,异动/止损/急跌只进broadcast⑤anomaly_monitor delivery→broadcast

This commit is contained in:
xxm
2026-08-24 11:08:16 +08:00
parent f621e5466c
commit 30dbb8a667
4 changed files with 19 additions and 10 deletions
+1 -1
View File
@@ -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]=cost518880成本2400 bug
return codes, names, costs
def check_anomalies():
+4
View File
@@ -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, "
+7 -2
View File
@@ -199,11 +199,16 @@ 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)
if _is_advice:
try:
from alert_helper import notify, ACTION
notify(category, text, ACTION)
+2 -2
View File
@@ -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: