From bc86723b390a9a4ba32b29c11c9f8f9c92b7cf2f Mon Sep 17 00:00:00 2001 From: dekun Date: Wed, 30 Sep 2026 22:40:28 +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=E7=9B=88=E4=BA=8F=E9=97=AA=E7=83=81=EF=BC=9A=E8=B5=84?= =?UTF-8?q?=E9=87=91=E5=BF=AB=E7=85=A7=E4=B8=8E=E6=8C=81=E4=BB=93=E8=BD=AE?= =?UTF-8?q?=E8=AF=A2=E4=B8=8D=E5=86=8D=E4=B8=80=E6=9D=A1=E6=8C=89=E5=B8=81?= =?UTF-8?q?=C3=97=E6=8C=87=E6=95=B0=E3=80=81=E4=B8=80=E6=9D=A1=E6=8C=89U?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 两条路径抢写实时盈亏会导致一会正常一会上万;统一走 paintRealtimePnlFromSnapshot。 Co-authored-by: Cursor --- lib/instance/templates/embed_boot_scripts.html | 12 ++---------- lib/instance/templates/index.html | 13 ++----------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/lib/instance/templates/embed_boot_scripts.html b/lib/instance/templates/embed_boot_scripts.html index af49498..f1d651e 100644 --- a/lib/instance/templates/embed_boot_scripts.html +++ b/lib/instance/templates/embed_boot_scripts.html @@ -1304,16 +1304,8 @@ function applyAccountSnapshot(data){ setFundsFieldText("options-trading-usdc", optTrading); } if(typeof data.unrealized_pnl !== "undefined" || typeof data.options_unrealized_pnl !== "undefined"){ - const coinMode = String(data.options_margin_mode || "").toLowerCase() === "coin"; - if (coinMode && data.options_unrealized_pnl != null && !Number.isNaN(Number(data.options_unrealized_pnl))) { - paintRealtimePnl( - data.options_unrealized_pnl, - String(data.options_underly || "ETH").toUpperCase() || "ETH", - data.options_index_px - ); - } else if (typeof data.unrealized_pnl !== "undefined") { - updateRealtimePnl(data.unrealized_pnl, "U"); - } + // 与 order_prices 轮询共用:options_unrealized_pnl 已是 U,勿再按 ETH×指数(否则顶栏会在正确/上万之间闪烁) + paintRealtimePnlFromSnapshot(data); } if(typeof data.total !== "undefined" && data.total !== null){ setFundsFieldText("stat-total", String(data.total)); diff --git a/lib/instance/templates/index.html b/lib/instance/templates/index.html index 6675cd6..4ba8631 100644 --- a/lib/instance/templates/index.html +++ b/lib/instance/templates/index.html @@ -1785,17 +1785,8 @@ function applyAccountSnapshot(data){ setFundsFieldText("options-trading-usdc", optTrading); } if(typeof data.unrealized_pnl !== "undefined" || typeof data.options_unrealized_pnl !== "undefined"){ - const coinMode = String(data.options_margin_mode || "").toLowerCase() === "coin"; - if (coinMode && data.options_unrealized_pnl != null && !Number.isNaN(Number(data.options_unrealized_pnl))) { - // 币本位:顶栏跟持仓卡同口径(期权净盈亏),勿用混加后的 unrealized_pnl(会被抹成 0.00) - paintRealtimePnl( - data.options_unrealized_pnl, - String(data.options_underly || "ETH").toUpperCase() || "ETH", - data.options_index_px - ); - } else if (typeof data.unrealized_pnl !== "undefined") { - updateRealtimePnl(data.unrealized_pnl, "U"); - } + // 与 order_prices 轮询共用:options_unrealized_pnl 已是 U,勿再按 ETH×指数(否则顶栏会在正确/上万之间闪烁) + paintRealtimePnlFromSnapshot(data); } if(typeof data.total !== "undefined" && data.total !== null){ setFundsFieldText("stat-total", String(data.total));