修复期权历史/复盘金额为0:模拟盘合成历史、币本位按ETH精度展示,复盘折算为U。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-20 21:51:01 +08:00
parent 4eef0d9fd6
commit e1c2e5889f
6 changed files with 255 additions and 17 deletions
+16 -2
View File
@@ -2526,10 +2526,24 @@
}
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 premCcy = posPremiumCcy(h);
const unit = premCcy === "USDC" ? "U" : premCcy;
const premCore = fmtDisplay(
h.premium_paid_fmt,
h.premium_paid != null ? fmtPremiumAmt(h.premium_paid, premCcy) : null
);
const premTxt = premCore === "—" ? "—" : premCore + " " + unit;
const isOpen = h.status === "open";
const pnl = isOpen ? null : h.realized_pnl;
const pnlTxt = pnl != null ? fmt(pnl, 2) : "—";
let pnlTxt = "—";
if (pnl != null && !Number.isNaN(Number(pnl))) {
const n = Number(pnl);
const absCore = fmtDisplay(
null,
fmtPremiumAmt(Math.abs(n), premCcy)
);
pnlTxt = (n > 0 ? "+" : n < 0 ? "-" : "") + absCore + " " + unit;
}
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);
const histKey = h.history_key || "";
+1 -1
View File
@@ -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) {