修复币本位期权历史权利金/盈亏显示0.00;复盘盈亏按指数换算为U
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2560,11 +2560,25 @@
|
||||
}
|
||||
list.forEach(function (h) {
|
||||
const tr = document.createElement("tr");
|
||||
const premTxt = fmtDisplay(h.premium_paid_fmt, h.premium_paid != null ? fmtUsdc(h.premium_paid) : null);
|
||||
const ccy = posPremiumCcy(h);
|
||||
const premTxt =
|
||||
h.premium_paid != null && !Number.isNaN(Number(h.premium_paid))
|
||||
? fmtPremiumAmt(h.premium_paid, ccy) + (ccy !== "USDC" ? " " + ccy : "")
|
||||
: "—";
|
||||
const isOpen = h.status === "open";
|
||||
const pnl = isOpen ? null : h.realized_pnl;
|
||||
const pnlTxt = pnl != null ? fmt(pnl, 2) : "—";
|
||||
const pnlCls = pnl > 0 ? "pos-pnl-profit" : pnl < 0 ? "pos-pnl-loss" : "";
|
||||
let pnlTxt = "—";
|
||||
let pnlCls = "";
|
||||
if (pnl != null && !Number.isNaN(Number(pnl))) {
|
||||
const n = Number(pnl);
|
||||
pnlCls = n > 0 ? "pos-pnl-profit" : n < 0 ? "pos-pnl-loss" : "";
|
||||
if (ccy === "ETH" || ccy === "BTC") {
|
||||
const sign = n > 0 ? "+" : n < 0 ? "-" : "";
|
||||
pnlTxt = sign + fmtPremiumAmt(Math.abs(n), ccy) + " " + ccy;
|
||||
} else {
|
||||
pnlTxt = (n > 0 ? "+" : "") + fmt(n, 2);
|
||||
}
|
||||
}
|
||||
const timeTxt = (h.closed_at || h.created_at || "—").replace("T", " ").slice(0, 19);
|
||||
const histKey = h.history_key || "";
|
||||
tr.innerHTML =
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
if (v == null || v === "") return "—";
|
||||
var n = Number(v);
|
||||
if (Number.isNaN(n)) return "—";
|
||||
return (n >= 0 ? "+" : "") + n.toFixed(2);
|
||||
return (n >= 0 ? "+" : "") + n.toFixed(2) + "U";
|
||||
}
|
||||
|
||||
function fmtHold(sec) {
|
||||
|
||||
Reference in New Issue
Block a user