修复实例顶栏盈亏闪烁:资金快照与持仓轮询不再一条按币×指数、一条按U。
两条路径抢写实时盈亏会导致一会正常一会上万;统一走 paintRealtimePnlFromSnapshot。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1304,16 +1304,8 @@ function applyAccountSnapshot(data){
|
|||||||
setFundsFieldText("options-trading-usdc", optTrading);
|
setFundsFieldText("options-trading-usdc", optTrading);
|
||||||
}
|
}
|
||||||
if(typeof data.unrealized_pnl !== "undefined" || typeof data.options_unrealized_pnl !== "undefined"){
|
if(typeof data.unrealized_pnl !== "undefined" || typeof data.options_unrealized_pnl !== "undefined"){
|
||||||
const coinMode = String(data.options_margin_mode || "").toLowerCase() === "coin";
|
// 与 order_prices 轮询共用:options_unrealized_pnl 已是 U,勿再按 ETH×指数(否则顶栏会在正确/上万之间闪烁)
|
||||||
if (coinMode && data.options_unrealized_pnl != null && !Number.isNaN(Number(data.options_unrealized_pnl))) {
|
paintRealtimePnlFromSnapshot(data);
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(typeof data.total !== "undefined" && data.total !== null){
|
if(typeof data.total !== "undefined" && data.total !== null){
|
||||||
setFundsFieldText("stat-total", String(data.total));
|
setFundsFieldText("stat-total", String(data.total));
|
||||||
|
|||||||
@@ -1785,17 +1785,8 @@ function applyAccountSnapshot(data){
|
|||||||
setFundsFieldText("options-trading-usdc", optTrading);
|
setFundsFieldText("options-trading-usdc", optTrading);
|
||||||
}
|
}
|
||||||
if(typeof data.unrealized_pnl !== "undefined" || typeof data.options_unrealized_pnl !== "undefined"){
|
if(typeof data.unrealized_pnl !== "undefined" || typeof data.options_unrealized_pnl !== "undefined"){
|
||||||
const coinMode = String(data.options_margin_mode || "").toLowerCase() === "coin";
|
// 与 order_prices 轮询共用:options_unrealized_pnl 已是 U,勿再按 ETH×指数(否则顶栏会在正确/上万之间闪烁)
|
||||||
if (coinMode && data.options_unrealized_pnl != null && !Number.isNaN(Number(data.options_unrealized_pnl))) {
|
paintRealtimePnlFromSnapshot(data);
|
||||||
// 币本位:顶栏跟持仓卡同口径(期权净盈亏),勿用混加后的 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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(typeof data.total !== "undefined" && data.total !== null){
|
if(typeof data.total !== "undefined" && data.total !== null){
|
||||||
setFundsFieldText("stat-total", String(data.total));
|
setFundsFieldText("stat-total", String(data.total));
|
||||||
|
|||||||
Reference in New Issue
Block a user