From f15752485e6c4d32f03148b87b5bccc594d00888 Mon Sep 17 00:00:00 2001 From: xxm Date: Mon, 24 Aug 2026 11:15:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8E=A8=E8=8D=90=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E9=99=8412=E7=BB=B4=E5=AE=8C=E6=95=B4=E5=88=86=E6=9E=90?= =?UTF-8?q?=E2=80=94=E2=80=94push=5Frecommend=5Falert=E5=8D=95=E5=8F=AA?= =?UTF-8?q?=E6=8E=A8=E8=8D=90/flush=E6=91=98=E8=A6=81=E4=BE=9D=E6=8D=AE?= =?UTF-8?q?=E6=AE=B5=E5=9D=87=E9=99=84full=5Fanalysis=E5=85=A8=E6=96=87(?= =?UTF-8?q?=E8=80=81=E8=8E=AB:=E4=B8=8D=E8=83=BD=E5=8F=AA=E6=9C=89?= =?UTF-8?q?=E4=B8=80=E8=A1=8C=E6=96=87=E5=AD=97)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/profile-scripts/mofin_db.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/deploy/profile-scripts/mofin_db.py b/deploy/profile-scripts/mofin_db.py index d10776e3..f9452faf 100644 --- a/deploy/profile-scripts/mofin_db.py +++ b/deploy/profile-scripts/mofin_db.py @@ -1759,12 +1759,13 @@ def flush_rec_digest(max_items=5): _live = [] for it in items: r = _vconn.execute( - "SELECT timing_signal, rr_ratio, tag, reassessed_at FROM holding_strategies WHERE code=? AND status='active'", + "SELECT timing_signal, rr_ratio, tag, reassessed_at, full_analysis FROM holding_strategies WHERE code=? AND status='active'", (it['code'],)).fetchone() if not r: print(f" [REC] {it['code']} 已不在库,丢弃", flush=True) continue cur_sig, cur_rr, cur_tag, cur_ra = r[0] or "", r[1] or 0, r[2] or "", r[3] or "" + it['full_analysis'] = r[4] or it.get('full_analysis') or '' # 2026-08-24 依据用最新全文 if cur_tag != 'current_recommend': print(f" [REC] {it['code']} tag已撤销({cur_tag}),丢弃", flush=True) continue @@ -1931,11 +1932,10 @@ def flush_rec_digest(max_items=5): f" {_rr_txt} 仓位{it.get('position') or '—'}") if it.get('_stale_warn'): lines.append(f" ⚠️ {it['_stale_warn']}") - # 所有推荐都附完整策略依据 - if it.get('strategy_excerpt'): - lines.append(f" 依据: {it['strategy_excerpt']}") - elif it.get('full_analysis'): - lines.append(f" 依据: {it['full_analysis']}") + # 所有推荐都附12维完整分析(2026-08-24 老莫:不能只有一行文字/片段) + _fa = it.get('full_analysis') or it.get('strategy_excerpt') or '' + if _fa: + lines.append(f" 【12维完整分析】\n{_fa}") if len(items) > max_items: lines.append(f"…另有 {len(items) - max_items} 只详见盯盘推荐操作区") if cash_note: @@ -1969,11 +1969,11 @@ def push_recommend_alert(conn, code: str): try: row = conn.execute( "SELECT name, timing_signal, entry_low, entry_high, stop_loss, take_profit, " - "rr_ratio, position_advice FROM holding_strategies WHERE code=? AND status='active'", + "rr_ratio, position_advice, full_analysis FROM holding_strategies WHERE code=? AND status='active'", (code,)).fetchone() if not row: return False - name, sig, el, eh, sl, tp, rr, pos = row + name, sig, el, eh, sl, tp, rr, pos, fa = row lp = conn.execute("SELECT price FROM live_prices WHERE code=?", (code,)).fetchone() price = lp[0] if lp and lp[0] else 0 el, eh, sl, tp = el or 0, eh or 0, sl or 0, tp or 0 @@ -1991,8 +1991,11 @@ def push_recommend_alert(conn, code: str): import sys as _s, os as _o _s.path.insert(0, _o.path.dirname(_o.path.abspath(__file__))) _mid_xmpp = f"{(el+eh)/2:.2f}" if el > 0 and eh > el else "—" + # 2026-08-24 老莫:推荐必须附12维完整分析,不能只有一行结论 msg = (f"📈 {name or code}({code}) 价{price}→12维{sig}!" f"区间{el}→{_mid_xmpp}←{eh} 损{sl} 盈{tp} RR={rr or 0} 仓位{pos or '-'}") + if fa: + msg += f"\n\n【12维完整分析】\n{fa}" return notify("买入信号", msg, ACTION) except Exception as e: print(f" [ALERT] {code} 推送异常: {e}", flush=True)