feat: 买入区间加中值显示(XMPP+盯盘)

This commit is contained in:
hmo
2026-07-27 12:24:11 +08:00
parent 58d7d34cf1
commit 5d043627ff
2 changed files with 20 additions and 6 deletions
+14 -4
View File
@@ -461,7 +461,9 @@ function renderWatchlist() {
<th class="text-right p-3">RR</th><th class="text-right p-3">信号</th><th class="text-right p-3">仓位</th>
</tr></thead>
<tbody>${stocks.map(s => {
const buyZone = (s.entry_low||0) + '~' + (s.entry_high||0);
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 rr = s.rr_ratio || 0;
const sl = s.stop_loss || 0;
const tp = s.take_profit || 0;
@@ -743,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}</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.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>
@@ -1452,7 +1454,11 @@ function fmtFullStrategy(s) {
const lines = [];
if (s.action) lines.push('操作: ' + s.action);
if (s.position_advice) lines.push('仓位建议: ' + s.position_advice);
if (s.entry_low || s.entry_high) lines.push('买入区间: ' + (s.entry_low||'—') + '~' + (s.entry_high||'—'));
if (s.entry_low || s.entry_high) {
const el2 = s.entry_low||0, eh2 = s.entry_high||0;
const mid2 = (el2 > 0 && eh2 > el2) ? ' 中值' + ((el2+eh2)/2).toFixed(2) : '';
lines.push('买入区间: ' + (s.entry_low||'—') + '~' + (s.entry_high||'—') + mid2);
}
if (s.stop_loss || s.take_profit) lines.push('止损: ' + (s.stop_loss||'—') + ' / 止盈: ' + (s.take_profit||'—'));
if (s.rr_ratio) lines.push('RR: ' + s.rr_ratio.toFixed(2));
if (s.timing_signal) lines.push('信号: ' + s.timing_signal);
@@ -1690,7 +1696,11 @@ async function openStrategyHistory(code) {
// 策略参数
const params = [];
if (h.entry_low || h.entry_high) params.push('买入区间: ' + (h.entry_low||'—') + '~' + (h.entry_high||'—'));
if (h.entry_low || h.entry_high) {
const el3 = h.entry_low||0, eh3 = h.entry_high||0;
const mid3 = (el3 > 0 && eh3 > el3) ? ' 中值' + ((el3+eh3)/2).toFixed(2) : '';
params.push('买入区间: ' + (h.entry_low||'—') + '~' + (h.entry_high||'—') + mid3);
}
if (h.stop_loss) params.push('止损: ¥' + h.stop_loss);
if (h.take_profit) params.push('止盈: ¥' + h.take_profit);
if (h.rr_ratio) params.push('RR: ' + h.rr_ratio.toFixed(2));