diff --git a/lib/common/static/options_position_cards.js b/lib/common/static/options_position_cards.js
index f6f4999..8e1e726 100644
--- a/lib/common/static/options_position_cards.js
+++ b/lib/common/static/options_position_cards.js
@@ -147,9 +147,10 @@
opts = opts || {};
const hub = !!opts.hub;
const readOnly = !!opts.readOnly;
- const net = netPnlFromPos(p);
- const roi = netRoiFromPos(p, net);
- const uplCls = pnlCls(net, hub);
+ const hidePnl = !!opts.hidePnl;
+ const net = hidePnl ? null : netPnlFromPos(p);
+ const roi = hidePnl ? null : netRoiFromPos(p, net);
+ const uplCls = hidePnl ? "" : pnlCls(net, hub);
const sideCls = (p.opt_type || "").toUpperCase() === "P" ? "pos-side-short" : "pos-side-long";
const expMs = p.exp_time_ms != null ? p.exp_time_ms : p.exp_time;
const expAttr = expMs != null && expMs !== "" ? String(expMs) : "";
@@ -166,6 +167,12 @@
'' +
"";
}
+ const pnlCells = hidePnl
+ ? ""
+ : '
净盈亏' +
+ (closePreview.bid_invalid || net == null ? "—" : fmt(net, 2)) + "
" +
+ '收益率' +
+ (closePreview.bid_invalid || roi == null ? "—" : fmt(roi, 2) + "%") + "
";
return (
'' +
'
' + (p.inst_id || "") + "" +
@@ -189,15 +196,12 @@
'
指数价' + fmt(p.idx_px, 0) + "
" +
'
到期平衡' + fmt(p.expiry_be_px, 0) + "
" +
'
平掉回本' + fmt(p.close_be_px, 0) + "
" +
- '
净盈亏' +
- (closePreview.bid_invalid || net == null ? "—" : fmt(net, 2)) + "
" +
- '
收益率' +
- (closePreview.bid_invalid || roi == null ? "—" : fmt(roi, 2) + "%") + "
" +
+ pnlCells +
'
买盘深度' + fmtCloseLevels(closePreview, tickSz) + "
" +
'
按买盘回收' +
(closePreview.bid_invalid
? '暂无有效买盘'
- : fmtClosePreview(closePreview, p.premium_paid, hub)) + "
" +
+ : fmtClosePreview(closePreview, hidePnl ? null : p.premium_paid, hub)) + "
" +
"
" +
(function () {
const hint = closeGateHint(closePreview);
@@ -217,19 +221,22 @@
const intrinsic = o === "C" ? Math.max(0, tgt - strike) : o === "P" ? Math.max(0, strike - tgt) : null;
if (intrinsic != null) {
value = Math.round(intrinsic * eth * 100) / 100;
- if (Number.isFinite(prem)) profit = Math.round((value - prem) * 100) / 100;
+ if (!hidePnl && Number.isFinite(prem)) profit = Math.round((value - prem) * 100) / 100;
}
}
const profitTxt = profit == null ? "—" : ((profit > 0 ? "+" : "") + fmtUsdc(profit) + " USDC");
const profitCls = profit > 0 ? " pnl-pos" : profit < 0 ? " pnl-neg" : "";
const hedgeTarget = p.hedge_plan_target || null;
const managed = hedgeTarget && hedgeTarget.managed_by === "hedge_plan";
+ const profitSpan = hidePnl
+ ? ""
+ : '预估盈利 ' + profitTxt + "";
return (
'' +
'' + (managed ? "对冲计划 #" + hedgeTarget.plan_id : "委托") + "" +
'目标 ' + fmt(p.target_index, 1) + "" +
'价值 ' + (value == null ? "—" : fmtUsdc(value) + " USDC") + "" +
- '预估盈利 ' + profitTxt + "" +
+ profitSpan +
'' +
(managed ? "进行中 · 由对冲计划监控,到位后仅平盈利腿" : "监控中 · 到位按买一限价平") +
"
"
diff --git a/manual_trading_hub/static/app.js b/manual_trading_hub/static/app.js
index 52a387d..cdb0ebb 100644
--- a/manual_trading_hub/static/app.js
+++ b/manual_trading_hub/static/app.js
@@ -2426,10 +2426,20 @@
lossN > 0 && Number.isFinite(Number(t.loss_pnl_u))
? `${esc(pnlSigned(t.loss_pnl_u, 2))}U`
: "—";
+ const showFloat = showAccountPnlPref();
const floatMain = esc(pnlSigned(floatVal, 2)) + "U";
const floatCls = Math.abs(floatVal) > 1e-9 ? pnlCls(floatVal) : "";
const foldLabel = collapsed ? "展开明细" : "收起";
- return `
+ const floatSummary = showFloat
+ ? `
`
+ : "";
+ const floatCell = showFloat ? cell("总浮盈亏", floatMain, "", floatCls) : "";
+ return `
@@ -2438,10 +2448,7 @@
交易日 ${esc(day)} · 北京时间 ${esc(String(resetH))}:00 切日
-
+ ${floatSummary}
@@ -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}
`;
@@ -3835,9 +3842,10 @@
function renderOptionsPositionsTable(pos, targets) {
if (!pos.length) return '
暂无期权持仓
';
+ const showPnl = showAccountPnlPref();
let html = '
';
- html +=
- "| 合约 | 类型 | 张数 | 到期倒计时 | 目标监控 | 净盈亏 | 收益率 | ";
+ html += "合约 | 类型 | 张数 | 到期倒计时 | 目标监控 | ";
+ if (showPnl) html += "净盈亏 | 收益率 | ";
html += "
";
pos.forEach((p) => {
const optType =
@@ -3861,10 +3869,12 @@
${esc(optType)} |
${esc(p.pos)} |
${optionsExpiryCdHtml(p.exp_time_ms != null ? p.exp_time_ms : p.exp_time)} |
- ${renderOptionsTargetCell(target)}
- ${net == null ? "—" : fmt(net, 2)} |
- ${roi == null ? "—" : esc(Number(roi).toFixed(2)) + "%"} |
- `;
+ ${renderOptionsTargetCell(target)}`;
+ if (showPnl) {
+ html += `${net == null ? "—" : fmt(net, 2)} |
+ ${roi == null ? "—" : esc(Number(roi).toFixed(2)) + "%"} | `;
+ }
+ html += "";
});
html += "
";
return html;
@@ -3892,8 +3902,9 @@
}
const cls = hubPosListCountClass(pos.length);
let html = `
`;
+ const hidePnl = !showAccountPnlPref();
pos.forEach((p) => {
- html += OptionsPositionCards.renderCard(p, { readOnly: true, hub: true });
+ html += OptionsPositionCards.renderCard(p, { readOnly: true, hub: true, hidePnl });
});
html += "
";
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 || {};
diff --git a/manual_trading_hub/static/index.html b/manual_trading_hub/static/index.html
index 43049cd..75b168f 100644
--- a/manual_trading_hub/static/index.html
+++ b/manual_trading_hub/static/index.html
@@ -16,7 +16,7 @@
-
+
@@ -1212,7 +1212,7 @@