feat: 买入区间中值突出显示(金色加粗,上下限之间) + XMPP同步 + no-cache

This commit is contained in:
hmo
2026-07-27 13:28:04 +08:00
parent eaeb6c2401
commit 844f556545
2 changed files with 8 additions and 6 deletions
+2 -2
View File
@@ -1557,7 +1557,7 @@ def flush_rec_digest(max_items=5):
_mid = f"{(_el+_eh)/2:.2f}" if _el > 0 and _eh > _el else ""
_badge = "💰可执行" if it['code'] in _exec_codes else "⏳排队"
lines.append(f"{_badge} {it.get('name') or it['code']}({it['code']}) {it['signal']}"
f"{_el or ''}~{_eh or ''}(中{_mid})"
f"{_el or ''}{_mid}{_eh or ''}"
f"{it.get('stop_loss') or ''}{it.get('take_profit') or ''}"
f" {_rr_txt} 仓位{it.get('position') or ''}")
if it.get('_stale_warn'):
@@ -1615,7 +1615,7 @@ def push_recommend_alert(conn, code: str):
from alert_helper import notify, ACTION
_mid_xmpp = f"{(el+eh)/2:.2f}" if el > 0 and eh > el else ""
msg = (f"📈 {name or code}({code}) 价{price}→12维{sig}"
f"区间{el}~{eh}(中{_mid_xmpp}){sl}{tp} RR={rr or 0} 仓位{pos or '-'}")
f"区间{el}{_mid_xmpp}{eh}{sl}{tp} RR={rr or 0} 仓位{pos or '-'}")
return notify("买入信号", msg, ACTION)
except Exception as e:
print(f" [ALERT] {code} 推送异常: {e}", flush=True)
+6 -4
View File
@@ -462,8 +462,8 @@ function renderWatchlist() {
</tr></thead>
<tbody>${stocks.map(s => {
const el = s.entry_low||0, eh = s.entry_high||0;
const mid = (el > 0 && eh > el) ? ('(中' + ((el+eh)/2).toFixed(2) + '') : '';
const buyZone = el + '~' + eh + mid;
const mid = (el > 0 && eh > el) ? (' <b class="text-amber-300">' + ((el+eh)/2).toFixed(2) + '</b> ') : '~';
const buyZone = el + mid + eh;
const rr = s.rr_ratio || 0;
const sl = s.stop_loss || 0;
const tp = s.take_profit || 0;
@@ -745,7 +745,7 @@ async function openStock(code) {
<div class="bg-slate-800/40 rounded-lg p-3 space-y-1.5 text-xs">
<div class="flex flex-wrap gap-x-4 gap-y-1 font-mono">
${sd.timing_signal?`<span>信号 <b class="${sd.timing_signal.includes('买入')?'text-green-400':sd.timing_signal.includes('卖出')?'text-red-400':'text-yellow-400'}">${sd.timing_signal}</b></span>`:''}
${sd.entry_low?`<span class="text-slate-300">区间 ${sd.entry_low}~${sd.entry_high} 中值${((sd.entry_low+sd.entry_high)/2).toFixed(2)}</span>`:''}
${sd.entry_low?`<span class="text-slate-300">区间 ${sd.entry_low} <b class="text-amber-300">${((sd.entry_low+sd.entry_high)/2).toFixed(2)}</b> ${sd.entry_high}</span>`:''}
${sd.stop_loss?`<span class="text-red-400">损 ${sd.stop_loss}</span>`:''}
${sd.take_profit?`<span class="text-green-400">盈 ${sd.take_profit}</span>`:''}
<span class="${rrMid>=1.5?'text-green-400':'text-yellow-400'}">RR ${rrTxt}</span>
@@ -1586,7 +1586,9 @@ async function renderWatch() {
const shares = s.shares || 0;
const posPct = s.position_pct || 0;
const buyZone = (el_ && eh_) ? el_.toFixed(2) + '~' + eh_.toFixed(2) + '(中' + ((el_+eh_)/2).toFixed(2) + '' : '—';
const buyZone = (el_ && eh_)
? el_.toFixed(2) + ' <b class="text-amber-300">' + ((el_+eh_)/2).toFixed(2) + '</b> ' + eh_.toFixed(2)
: '—';
const sltp = (sl_ || tp_) ? '损' + (sl_||'—') + '/盈' + (tp_||'—') : '—';
const posDisplay = (isRec && s.suggested_position_pct)
? '建议' + s.suggested_position_pct + '%'