fix模拟盘盈亏:收回×卖回价 − 开仓U权利金 − 手续费,历史按U展示。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2833,12 +2833,15 @@
|
||||
list.forEach(function (h) {
|
||||
const tr = document.createElement("tr");
|
||||
const premCcy = posPremiumCcy(h);
|
||||
const unit = premCcy === "USDC" ? "U" : premCcy;
|
||||
const premUnit = premCcy === "USDC" || premCcy === "USDT" ? "U" : premCcy;
|
||||
// 模拟盘盈亏已折 U 时用 pnl_display_ccy,勿再标 BTC
|
||||
const pnlCcy = String(h.pnl_display_ccy || premCcy).toUpperCase();
|
||||
const pnlUnit = pnlCcy === "USDC" || pnlCcy === "USDT" ? "U" : pnlCcy;
|
||||
const premCore = fmtDisplay(
|
||||
h.premium_paid_fmt,
|
||||
h.premium_paid != null ? fmtPremiumAmt(h.premium_paid, premCcy) : null
|
||||
);
|
||||
const premTxt = premCore === "—" ? "—" : premCore + " " + unit;
|
||||
const premTxt = premCore === "—" ? "—" : premCore + " " + premUnit;
|
||||
const isOpen = h.status === "open";
|
||||
const pnl = isOpen ? null : h.realized_pnl;
|
||||
let pnlTxt = "—";
|
||||
@@ -2846,9 +2849,9 @@
|
||||
const n = Number(pnl);
|
||||
const absCore = fmtDisplay(
|
||||
null,
|
||||
fmtPremiumAmt(Math.abs(n), premCcy)
|
||||
pnlUnit === "U" ? fmt(Math.abs(n), 2) : fmtPremiumAmt(Math.abs(n), pnlCcy)
|
||||
);
|
||||
pnlTxt = (n > 0 ? "+" : n < 0 ? "-" : "") + absCore + " " + unit;
|
||||
pnlTxt = (n > 0 ? "+" : n < 0 ? "-" : "") + absCore + " " + pnlUnit;
|
||||
}
|
||||
const pnlCls = pnl > 0 ? "pos-pnl-profit" : pnl < 0 ? "pos-pnl-loss" : "";
|
||||
const timeTxt = (h.closed_at || h.created_at || "—").replace("T", " ").slice(0, 19);
|
||||
|
||||
Reference in New Issue
Block a user