From 232e5e4b9257873d15b7d616d7ac4c9e1428a9d9 Mon Sep 17 00:00:00 2001 From: dekun Date: Wed, 30 Sep 2026 22:35:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9E=E4=BE=8B=E9=A1=B6?= =?UTF-8?q?=E6=A0=8F=E5=AE=9E=E6=97=B6=E7=9B=88=E4=BA=8F=E4=BA=8C=E6=AC=A1?= =?UTF-8?q?=E6=8A=98=E7=AE=97=EF=BC=9A=E5=B8=81=E6=9C=AC=E4=BD=8D=20option?= =?UTF-8?q?s=20=E6=B5=AE=E7=9B=88=E5=B7=B2=E6=98=AF=20U=EF=BC=8C=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E4=B8=8D=E5=86=8D=E4=B9=98=E6=8C=87=E6=95=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 约 +4.3U 被当成 ETH 再 ×2700 显示成 +1.1万U;顶栏改为直接按 U 展示/与永续相加。 Co-authored-by: Cursor --- lib/instance/templates/embed_boot_scripts.html | 15 ++++++--------- lib/instance/templates/index.html | 16 ++++++---------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/lib/instance/templates/embed_boot_scripts.html b/lib/instance/templates/embed_boot_scripts.html index 4821929..af49498 100644 --- a/lib/instance/templates/embed_boot_scripts.html +++ b/lib/instance/templates/embed_boot_scripts.html @@ -1161,18 +1161,15 @@ function paintRealtimePnlFromSnapshot(data){ const spotPx = data.options_index_px != null ? Number(data.options_index_px) : null; if (coinMode) { if (opt != null && !Number.isNaN(Number(opt))) { + // options_unrealized_pnl 已是 USDT(后端按指数折算),勿再 × 指数 if (perp != null && Math.abs(Number(perp)) >= 0.005) { - // 顶栏只显示合计 U:永续 U + 期权币盈亏×指数 - let totalU = Number(perp); - if (Number.isFinite(spotPx) && spotPx > 0) { - totalU += Number(opt) * spotPx; - } + const totalU = Number(perp) + Number(opt); const uAbs = Math.abs(totalU).toFixed(2); const uSign = totalU < 0 ? "-" : totalU > 0 ? "+" : ""; const text = `${uSign}${uAbs}U`; lastRealtimePnl = Number(opt); - lastRealtimePnlUnit = underly; - lastRealtimePnlSpotPx = spotPx; + lastRealtimePnlUnit = "U"; + lastRealtimePnlSpotPx = null; document.querySelectorAll('[data-funds-field="realtime-pnl"]').forEach((pnlEl) => { pnlEl.innerText = text; pnlEl.classList.toggle("pnl-pos", totalU > 0); @@ -1180,11 +1177,11 @@ function paintRealtimePnlFromSnapshot(data){ }); return; } - paintRealtimePnl(opt, underly, spotPx); + paintRealtimePnl(opt, "U"); return; } // 期权盈亏拉取失败时保留上次有效值,避免顶栏闪成 0/— - if (lastRealtimePnl != null && (lastRealtimePnlUnit === "ETH" || lastRealtimePnlUnit === "BTC")) { + if (lastRealtimePnl != null && lastRealtimePnlUnit === "U") { return; } } diff --git a/lib/instance/templates/index.html b/lib/instance/templates/index.html index 328ae89..6675cd6 100644 --- a/lib/instance/templates/index.html +++ b/lib/instance/templates/index.html @@ -1642,19 +1642,15 @@ function paintRealtimePnlFromSnapshot(data){ const spotPx = data.options_index_px != null ? Number(data.options_index_px) : null; if (coinMode) { if (opt != null && !Number.isNaN(Number(opt))) { - // 币本位期权盈亏单位为币,勿与永续 U 混加成「xxU」 + // options_unrealized_pnl 已是 USDT(后端按指数折算),勿再 × 指数 if (perp != null && Math.abs(Number(perp)) >= 0.005) { - // 顶栏只显示合计 U:永续 U + 期权币盈亏×指数 - let totalU = Number(perp); - if (Number.isFinite(spotPx) && spotPx > 0) { - totalU += Number(opt) * spotPx; - } + const totalU = Number(perp) + Number(opt); const uAbs = Math.abs(totalU).toFixed(2); const uSign = totalU < 0 ? "-" : totalU > 0 ? "+" : ""; const text = `${uSign}${uAbs}U`; lastRealtimePnl = Number(opt); - lastRealtimePnlUnit = underly; - lastRealtimePnlSpotPx = spotPx; + lastRealtimePnlUnit = "U"; + lastRealtimePnlSpotPx = null; document.querySelectorAll('[data-funds-field="realtime-pnl"]').forEach((pnlEl) => { pnlEl.innerText = text; pnlEl.classList.toggle("pnl-pos", totalU > 0); @@ -1662,11 +1658,11 @@ function paintRealtimePnlFromSnapshot(data){ }); return; } - paintRealtimePnl(opt, underly, spotPx); + paintRealtimePnl(opt, "U"); return; } // 期权盈亏拉取失败时保留上次有效值,避免顶栏闪成 0/— - if (lastRealtimePnl != null && (lastRealtimePnlUnit === "ETH" || lastRealtimePnlUnit === "BTC")) { + if (lastRealtimePnl != null && lastRealtimePnlUnit === "U") { return; } }