From a42e3a16e5c11e0f53cf56110f5e41b9daccbb07 Mon Sep 17 00:00:00 2001 From: hmo Date: Wed, 22 Jul 2026 09:31:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=9B=AF=E7=9B=98):=20=E7=AD=9B=E9=80=89/?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E6=8E=A7=E5=88=B6=E6=9D=A1=E2=80=94=E2=80=94?= =?UTF-8?q?=E4=BF=A1=E5=8F=B7=E5=A4=9A=E9=80=89chips+=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E4=B8=8B=E6=8B=89(RR=E5=8D=87=E9=99=8D/=E6=B6=A8=E8=B7=8C?= =?UTF-8?q?=E5=8D=87=E9=99=8D)+RR=E4=B8=8B=E9=99=90=E8=BF=87=E6=BB=A4+?= =?UTF-8?q?=E9=87=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/index.html | 82 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 2 deletions(-) diff --git a/static/index.html b/static/index.html index 7e541632..2f763e1d 100644 --- a/static/index.html +++ b/static/index.html @@ -94,6 +94,28 @@ body { background: #0f0f13; color: #e2e8f0; }

👁️ 盯盘 · 全部策略

0 + +
+
+ 信号: + + + +
+
+ 排序: + + RR ≥ + + +
+
@@ -1368,18 +1390,74 @@ function fmtFullStrategy(s) { return lines.join('\n'); } +// ── 盯盘筛选/排序状态 ── +const WATCH_SIGNALS = ['买入','可买入','可加仓','卖出','止盈','关注','观望','持有','弱势持有','信号不充分']; +let watchSigFilter = new Set(WATCH_SIGNALS); // 默认全选 +let watchChipsInit = false; + +function watchRenderChips() { + const host = document.getElementById('watchSigChips'); + if (!host) return; + host.innerHTML = WATCH_SIGNALS.map(sig => { + const on = watchSigFilter.has(sig); + const cls = on + ? 'bg-amber-500/25 text-amber-300 border-amber-500/50' + : 'bg-slate-800/50 text-slate-500 border-slate-700'; + return ``; + }).join(''); +} +function watchToggleSig(sig) { + if (watchSigFilter.has(sig)) watchSigFilter.delete(sig); + else watchSigFilter.add(sig); + watchRenderChips(); + renderWatch(); +} +function watchSigAll(all) { + watchSigFilter = all ? new Set(WATCH_SIGNALS) : new Set(); + watchRenderChips(); + renderWatch(); +} +function watchResetFilters() { + watchSigFilter = new Set(WATCH_SIGNALS); + document.getElementById('watchSortMode').value = 'default'; + document.getElementById('watchMinRR').value = ''; + watchRenderChips(); + renderWatch(); +} + async function renderWatch() { const el = document.getElementById('watchContent'); if (!el) return; try { if (watchTimer) clearInterval(watchTimer); + if (!watchChipsInit) { watchRenderChips(); watchChipsInit = true; } const data = await fetchJSON('/api/watch'); - const stocks = data.stocks || []; + let stocks = data.stocks || []; + + // ── 筛选:信号多选 + RR下限 ── + const minRR = parseFloat(document.getElementById('watchMinRR')?.value) || 0; + stocks = stocks.filter(s => { + const sig = s.timing_signal || '信号不充分'; + if (!watchSigFilter.has(sig)) return false; + if (minRR > 0 && (s.rr_ratio || 0) < minRR) return false; + return true; + }); + + // ── 排序:默认=服务端分组序;覆盖模式按选定键全组内排序 ── + const sortMode = document.getElementById('watchSortMode')?.value || 'default'; + const sorters = { + rr_desc: (a, b) => (b.rr_ratio || 0) - (a.rr_ratio || 0), + rr_asc: (a, b) => (a.rr_ratio || 0) - (b.rr_ratio || 0), + chg_desc: (a, b) => (b.change_pct || 0) - (a.change_pct || 0), + chg_asc: (a, b) => (a.change_pct || 0) - (b.change_pct || 0), + }; + if (sorters[sortMode]) stocks = [...stocks].sort(sorters[sortMode]); + document.getElementById('watchCount').textContent = stocks.length; document.getElementById('watchRefreshTime').textContent = new Date().toLocaleTimeString(); if (stocks.length === 0) { - el.innerHTML = '
暂无策略数据
'; + el.innerHTML = '
当前筛选条件下暂无个股(调整筛选或点重置)
'; return; }