From 5a3904ad85ccafa8f6b048186654033741a2ea3a Mon Sep 17 00:00:00 2001 From: dekun Date: Fri, 2 Oct 2026 16:13:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=BB=E8=A7=88=E5=A2=9E=E5=8A=A0=E6=9D=83?= =?UTF-8?q?=E5=88=A9=E9=87=91=E4=B8=8E=E8=B5=84=E9=87=91=E5=8D=A0=E6=AF=94?= =?UTF-8?q?=E4=B8=A4=E5=88=97=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- static/hub.js | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/static/hub.js b/static/hub.js index a5ece38..54ede94 100644 --- a/static/hub.js +++ b/static/hub.js @@ -132,6 +132,57 @@ return '"; } + function fmtMoneyU(v) { + if (v == null || v === "") return "—"; + const n = Number(v); + if (!Number.isFinite(n)) return "—"; + return n.toFixed(2) + " U"; + } + + function fmtRatioPct(v) { + if (v == null || v === "") return "—"; + const n = Number(v); + if (!Number.isFinite(n)) return "—"; + return n.toFixed(2) + "%"; + } + + function premiumCell(snap) { + const prem = snap.premium || {}; + const paid = prem.paid_usdt; + const equity = prem.equity_usdt; + const ratio = prem.ratio_pct; + const tip = + equity != null + ? "账户资金(资+交) " + fmtMoneyU(equity) + : "账户资金暂无"; + return ( + '' + + escapeHtml(fmtMoneyU(paid)) + + "" + ); + } + + function premiumRatioCell(snap) { + const prem = snap.premium || {}; + const ratio = prem.ratio_pct; + const tip = + prem.paid_usdt != null && prem.equity_usdt != null + ? "权利金 " + + fmtMoneyU(prem.paid_usdt) + + " / 账户 " + + fmtMoneyU(prem.equity_usdt) + : ""; + return ( + '' + + escapeHtml(fmtRatioPct(ratio)) + + "" + ); + } + function renderRow(row) { const snap = row.snapshot || {}; const inst = snap.instance || {}; @@ -164,6 +215,12 @@ fmtPnlHtml(pnl) + "" + "" + + premiumCell(snap) + + "" + + "" + + premiumRatioCell(snap) + + "" + + "" + positionSummary(brief) + "" + "" + @@ -248,7 +305,7 @@ grid.innerHTML = '
' + "" + - "" + + "" + "" + list.map(renderRow).join("") + "
名称状态模式浮盈持仓买一/流动性拉取时间操作名称状态模式浮盈权利金资金占比持仓买一/流动性拉取时间操作
";