feat: 推荐推送附12维完整分析——push_recommend_alert单只推荐/flush摘要依据段均附full_analysis全文(老莫:不能只有一行文字)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user