diff --git a/server.py b/server.py index e7907568..424d6524 100644 --- a/server.py +++ b/server.py @@ -109,11 +109,12 @@ def api_watchlist(): conn = sqlite3.connect("/home/hmo/MoFin/data/mofin.db") conn.row_factory = sqlite3.Row rows = conn.execute(""" - SELECT code, name, entry_low, entry_high, stop_loss, take_profit, - timing_signal, action, price, rr_ratio, updated_at - FROM holding_strategies - WHERE status='active' AND decision_type='自选策略' - ORDER BY code + SELECT hs.code, hs.name, hs.entry_low, hs.entry_high, hs.stop_loss, hs.take_profit, + hs.timing_signal, hs.action, lp.price, lp.change_pct, hs.rr_ratio, hs.updated_at + FROM holding_strategies hs + LEFT JOIN live_prices lp ON hs.code = lp.code + WHERE hs.status='active' AND hs.decision_type='自选策略' + ORDER BY hs.code """).fetchall() conn.close() stocks = [dict(r) for r in rows] diff --git a/static/index.html b/static/index.html index 5ba9b450..83ed3dfa 100644 --- a/static/index.html +++ b/static/index.html @@ -301,20 +301,25 @@ function renderWatchlist() { 股票现价 涨跌%买入区间 - 建议仓位推荐理由 + 信号策略 - ${stocks.map(s => ` + ${stocks.map(s => { + const buyZone = (s.entry_low||0) + '~' + (s.entry_high||0); + const rr = s.rr_ratio || 0; + const sl = s.stop_loss || 0; + const tp = s.take_profit || 0; + const signal = s.timing_signal || ''; + const action = (s.action||'').slice(0,60); + return `
${s.name}
${s.code}
${(s.price||'—')} - - ${(s.change_pct||0)>=0?'+':''}${(s.change_pct||0).toFixed(2)} - - ${s.analysis?.buy_low||'—'}~${s.analysis?.buy_high||'—'} - ${s.analysis?.position_recommend||'—'} - ${s.analysis?.reason||''} - - `).join('')} + ${(s.change_pct||0)>=0?'+':''}${(s.change_pct||0).toFixed(2)} + ${buyZone} + ${signal||'—'} + ${action||'—'} + `; + }).join('')} @@ -396,8 +401,8 @@ function refreshMarketData() { `).join('') : '
暂无
'}
-

🔍 小果扫描 (${xiaoguo.length})

- ${xiaoguo.length ? xiaoguo.slice(0,6).map(s => ` +

📊 信号汇总 (${sigs.length})

+ ${sigs.length ? sigs.slice(0,6).map(s => `
${s.overall_sentiment||'中性'} ${s.sector} ${(s.summary||'').slice(0,60)}