diff --git a/static/hub.css b/static/hub.css index 2a92a68..769ca15 100644 --- a/static/hub.css +++ b/static/hub.css @@ -403,6 +403,16 @@ button, .btn { .pos-brief li { margin: 2px 0; } +.pos-exit { + margin-top: 2px; + font-size: 0.76rem; + color: var(--text); + opacity: 0.9; +} +.pos-exit.muted { + color: var(--muted); + opacity: 1; +} .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); diff --git a/static/hub.js b/static/hub.js index 66b48a5..f482020 100644 --- a/static/hub.js +++ b/static/hub.js @@ -24,12 +24,36 @@ .replace(/"/g, """); } + function formatExitBrief(p) { + if (p && p.target_monitor_text && String(p.target_monitor_text).trim() && p.target_monitor_text !== "—") { + return String(p.target_monitor_text).trim(); + } + const parts = []; + const tgt = Number(p && p.target_index); + if (Number.isFinite(tgt) && tgt > 0) { + const ot = String((p && p.opt_type) || "").toUpperCase(); + const side = ot === "P" ? "Put≤" : ot === "C" ? "Call≥" : "目标"; + parts.push(side + " " + tgt); + } + if (p && p.profit_exit_enabled) { + const m = Number(p.profit_exit_mult); + if (Number.isFinite(m) && m > 0) { + parts.push(Math.abs(m - Math.round(m)) < 1e-9 ? Math.round(m) + "倍" : m + "倍"); + } else { + parts.push("利润出场"); + } + } + return parts.length ? parts.join(" · ") : "未设出场"; + } + function positionSummary(brief) { const list = brief || []; if (!list.length) return '暂无持仓'; const items = list.slice(0, 8).map(function (p) { const id = p.inst_id || ""; const sheets = escapeHtml(String(p.sheets != null ? p.sheets : "—")); + const exitText = formatExitBrief(p); + const exitCls = exitText === "未设出场" ? "muted" : ""; return ( "