Hide options PnL/ROI and daily float when account-PnL pref is off.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2426,10 +2426,20 @@
|
||||
lossN > 0 && Number.isFinite(Number(t.loss_pnl_u))
|
||||
? `<span class="${pnlCls(t.loss_pnl_u)}">${esc(pnlSigned(t.loss_pnl_u, 2))}U</span>`
|
||||
: "—";
|
||||
const showFloat = showAccountPnlPref();
|
||||
const floatMain = esc(pnlSigned(floatVal, 2)) + "U";
|
||||
const floatCls = Math.abs(floatVal) > 1e-9 ? pnlCls(floatVal) : "";
|
||||
const foldLabel = collapsed ? "展开明细" : "收起";
|
||||
return `<div class="card card-online monitor-stats-card${collapsed ? " is-collapsed" : ""}" data-monitor-stats="1">
|
||||
const floatSummary = showFloat
|
||||
? `<div class="monitor-stats-float-summary">
|
||||
<div class="monitor-stat-label">总浮盈亏</div>
|
||||
<div class="monitor-stat-value monitor-stats-float-value ${floatCls}">${floatMain}</div>
|
||||
</div>`
|
||||
: "";
|
||||
const floatCell = showFloat ? cell("总浮盈亏", floatMain, "", floatCls) : "";
|
||||
return `<div class="card card-online monitor-stats-card${collapsed ? " is-collapsed" : ""}${
|
||||
showFloat ? "" : " hide-float-pnl"
|
||||
}" data-monitor-stats="1">
|
||||
<div class="card-head monitor-stats-head">
|
||||
<div class="monitor-stats-head-main">
|
||||
<div class="card-title-row">
|
||||
@@ -2438,10 +2448,7 @@
|
||||
</div>
|
||||
<div class="card-sub">交易日 ${esc(day)} · 北京时间 ${esc(String(resetH))}:00 切日</div>
|
||||
</div>
|
||||
<div class="monitor-stats-float-summary">
|
||||
<div class="monitor-stat-label">总浮盈亏</div>
|
||||
<div class="monitor-stat-value monitor-stats-float-value ${floatCls}">${floatMain}</div>
|
||||
</div>
|
||||
${floatSummary}
|
||||
</div>
|
||||
<div class="card-body monitor-stats-detail">
|
||||
<div class="monitor-stats-grid">
|
||||
@@ -2450,7 +2457,7 @@
|
||||
${cell("持有仓位", String(Number(t.open_position_count) || 0), "", "")}
|
||||
${cell("盈利", String(winN), winSub, winN > 0 ? "pnl-pos" : "")}
|
||||
${cell("亏损", String(lossN), lossSub, lossN > 0 ? "pnl-neg" : "")}
|
||||
${cell("总浮盈亏", floatMain, "", floatCls)}
|
||||
${floatCell}
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
@@ -3835,9 +3842,10 @@
|
||||
|
||||
function renderOptionsPositionsTable(pos, targets) {
|
||||
if (!pos.length) return '<div class="empty-hint hub-slot-pos">暂无期权持仓</div>';
|
||||
const showPnl = showAccountPnlPref();
|
||||
let html = '<div class="table-wrap hub-options-table-wrap"><table class="hub-options-table"><thead><tr>';
|
||||
html +=
|
||||
"<th>合约</th><th>类型</th><th>张数</th><th>到期倒计时</th><th>目标监控</th><th>净盈亏</th><th>收益率</th>";
|
||||
html += "<th>合约</th><th>类型</th><th>张数</th><th>到期倒计时</th><th>目标监控</th>";
|
||||
if (showPnl) html += "<th>净盈亏</th><th>收益率</th>";
|
||||
html += "</tr></thead><tbody>";
|
||||
pos.forEach((p) => {
|
||||
const optType =
|
||||
@@ -3861,10 +3869,12 @@
|
||||
<td>${esc(optType)}</td>
|
||||
<td>${esc(p.pos)}</td>
|
||||
<td>${optionsExpiryCdHtml(p.exp_time_ms != null ? p.exp_time_ms : p.exp_time)}</td>
|
||||
${renderOptionsTargetCell(target)}
|
||||
<td class="${pnlCls(net)}">${net == null ? "—" : fmt(net, 2)}</td>
|
||||
<td class="${pnlCls(net)}">${roi == null ? "—" : esc(Number(roi).toFixed(2)) + "%"}</td>
|
||||
</tr>`;
|
||||
${renderOptionsTargetCell(target)}`;
|
||||
if (showPnl) {
|
||||
html += `<td class="${pnlCls(net)}">${net == null ? "—" : fmt(net, 2)}</td>
|
||||
<td class="${pnlCls(net)}">${roi == null ? "—" : esc(Number(roi).toFixed(2)) + "%"}</td>`;
|
||||
}
|
||||
html += "</tr>";
|
||||
});
|
||||
html += "</tbody></table></div>";
|
||||
return html;
|
||||
@@ -3892,8 +3902,9 @@
|
||||
}
|
||||
const cls = hubPosListCountClass(pos.length);
|
||||
let html = `<div class="hub-pos-list hub-opt-pos-list ${cls}" data-pos-count="${pos.length}">`;
|
||||
const hidePnl = !showAccountPnlPref();
|
||||
pos.forEach((p) => {
|
||||
html += OptionsPositionCards.renderCard(p, { readOnly: true, hub: true });
|
||||
html += OptionsPositionCards.renderCard(p, { readOnly: true, hub: true, hidePnl });
|
||||
});
|
||||
html += "</div>";
|
||||
return html;
|
||||
@@ -4356,15 +4367,13 @@
|
||||
if (optUpl != null && Number.isFinite(Number(optUpl))) {
|
||||
parts.push(`浮盈 ${fmt(optUpl, 2)}U`);
|
||||
}
|
||||
} else if (optUpl != null && Number.isFinite(Number(optUpl))) {
|
||||
parts.push(`浮盈 ${fmt(optUpl, 2)}U`);
|
||||
if (optUpl != null && Number.isFinite(Number(optUpl)) && openCount === 0) {
|
||||
// 永续空仓时主数字优先展示期权浮盈,避免一直显示 0U
|
||||
pnlShow = optUpl;
|
||||
pnlSuffix = "期权";
|
||||
}
|
||||
}
|
||||
optLine = parts.join(" · ");
|
||||
if (optUpl != null && Number.isFinite(Number(optUpl)) && openCount === 0) {
|
||||
// 永续空仓时主数字优先展示期权浮盈,避免一直显示 0U
|
||||
pnlShow = optUpl;
|
||||
pnlSuffix = "期权";
|
||||
}
|
||||
}
|
||||
}
|
||||
const hm = row.hub_monitor || {};
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Orbitron:wght@500;600;700&display=swap" rel="stylesheet" media="print" onload="this.media='all'" />
|
||||
<noscript><link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Orbitron:wght@500;600;700&display=swap" rel="stylesheet" /></noscript>
|
||||
<link rel="stylesheet" href="/assets/app.css?v=20260723-opt-acct" />
|
||||
<link rel="stylesheet" href="/assets/app.css?v=20260723-hide-pnl" />
|
||||
<link rel="stylesheet" href="/assets/trade_stats_calendar.css?v=4" />
|
||||
<link rel="stylesheet" href="/assets/account_risk_badge.css?v=4" />
|
||||
<script src="/assets/account_risk_badge.js?v=4"></script>
|
||||
@@ -1212,7 +1212,7 @@
|
||||
</div>
|
||||
<label class="chk-label settings-display-chk">
|
||||
<input type="checkbox" id="pref-show-account-pnl" checked />
|
||||
监控区显示资金账户、交易账户与浮动盈亏(含期权)
|
||||
监控区显示资金账户、交易账户与浮动盈亏(关闭可隐藏期权盈亏与今日总浮盈)
|
||||
</label>
|
||||
<label class="chk-label settings-display-chk">
|
||||
<input type="checkbox" id="pref-show-nav-funds" checked />
|
||||
@@ -1514,8 +1514,8 @@
|
||||
<script src="/assets/ai_review_render.js?v=3"></script>
|
||||
<script src="/assets/time_close_ui.js?v=3"></script>
|
||||
<script src="/assets/options_expiry_countdown.js?v=1"></script>
|
||||
<script src="/assets/options_position_cards.js?v=2"></script>
|
||||
<script src="/assets/options_position_cards.js?v=3"></script>
|
||||
<script src="/assets/backup.js?v=1"></script>
|
||||
<script src="/assets/app.js?v=20260723-opt-acct"></script>
|
||||
<script src="/assets/app.js?v=20260723-hide-pnl"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user