feat(盯盘): 推荐操作精选层——72h新鲜度+RR降序+现金预算贪心装入(上限5只)

老爸: 太多推荐=没有推荐。机制:
- 候选: tag非空 且 reassessed_at 72h内(陈旧信号不算推荐)
- 排序: rr_ratio 降序
- 预算: 从 portfolio_summary 读现金/总资产, 每只建议仓位
  (position_advice解析%或默认8%) 贪心累加, 耗尽即止, 最多5只
- 落选者降回持仓/自选自然组
- /api/watch 返回 cash/budget_pct/rec_used_pct, 前端显示预算条
- 推荐行仓位列显示'建议X%'
This commit is contained in:
hmo
2026-07-22 00:16:35 +08:00
parent 93f0b24007
commit c1b38d3d7b
2 changed files with 62 additions and 3 deletions
+7 -2
View File
@@ -1434,7 +1434,9 @@ async function renderWatch() {
const buyZone = (el_ && eh_) ? el_.toFixed(1) + '~' + eh_.toFixed(1) : '—';
const sltp = (sl_ || tp_) ? '损' + (sl_||'—') + '/盈' + (tp_||'—') : '—';
const posDisplay = posPct ? posPct.toFixed(1) + '%' : '—';
const posDisplay = (isRec && s.suggested_position_pct)
? '建议' + s.suggested_position_pct + '%'
: (posPct ? posPct.toFixed(1) + '%' : '—');
// 当前操作策略摘要
const strat = fmtStrategy(s);
@@ -1462,8 +1464,11 @@ async function renderWatch() {
}
html += '</tbody></table></div>';
// 更新时间
// 更新时间 + 推荐预算
html += '<div class="text-xs text-slate-600 mt-1">' + (data.updated_at ? '数据: ' + data.updated_at : '') + '</div>';
if (data.budget_pct !== undefined) {
html += '<div class="text-xs text-amber-500/70 mt-1">💰 现金 ' + (data.cash/10000).toFixed(1) + '万 / 总资产 ' + (data.total_assets/10000).toFixed(1) + '万 — 推荐操作预算 ' + data.budget_pct + '%(已用 ' + data.rec_used_pct + '%</div>';
}
el.innerHTML = html;
// 自动刷新:每30秒