feat(hub): show funding, trading account and unrealized PnL on monitor cards
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1354,7 +1354,7 @@ body.market-chart-fs-open {
|
||||
|
||||
.stat-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
@@ -2463,12 +2463,16 @@ body.login-page {
|
||||
}
|
||||
|
||||
.stat-row {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 8px;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 15px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.exchange-fullscreen {
|
||||
|
||||
@@ -854,7 +854,11 @@
|
||||
const pos = Array.isArray(ag.positions) ? ag.positions : [];
|
||||
const flaskOk = row.flask_ok !== false && hm.ok !== false;
|
||||
const upnl = Number(ag.total_unrealized_pnl);
|
||||
const balance = Number(ag.balance_usdt);
|
||||
const tradingBal = Number(row.trading_usdt);
|
||||
const balance =
|
||||
Number.isFinite(tradingBal) && tradingBal > 0
|
||||
? tradingBal
|
||||
: Number(ag.balance_usdt);
|
||||
const sortUpnl = Number.isFinite(upnl) ? upnl : 0;
|
||||
|
||||
if (!row.http_ok) {
|
||||
@@ -2298,12 +2302,18 @@
|
||||
</div>`;
|
||||
}
|
||||
|
||||
function renderAccountStatRow(row, ag) {
|
||||
const upnl = ag.total_unrealized_pnl;
|
||||
return `<div class="stat-row">
|
||||
<div class="stat-box"><div class="stat-label">资金账户</div><div class="stat-value">${fmt(row.funding_usdt, 2)} <small style="font-size:12px;color:var(--muted)">U</small></div></div>
|
||||
<div class="stat-box"><div class="stat-label">交易账户</div><div class="stat-value">${fmt(row.trading_usdt, 2)} <small style="font-size:12px;color:var(--muted)">U</small></div></div>
|
||||
<div class="stat-box"><div class="stat-label">浮盈合计</div><div class="stat-value ${pnlCls(upnl)}">${fmt(upnl, 2)}</div></div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
function renderGridBody(row, ag, pos, hm, flaskOk, keys, orders, trends, rolls, kmap) {
|
||||
const tickMap = buildPriceTickMap(row);
|
||||
let inner = `<div class="stat-row">
|
||||
<div class="stat-box"><div class="stat-label">余额</div><div class="stat-value">${fmt(ag.balance_usdt, 2)} <small style="font-size:12px;color:var(--muted)">U</small></div></div>
|
||||
<div class="stat-box"><div class="stat-label">浮盈合计</div><div class="stat-value ${pnlCls(ag.total_unrealized_pnl)}">${fmt(ag.total_unrealized_pnl, 2)}</div></div>
|
||||
</div>`;
|
||||
let inner = renderAccountStatRow(row, ag);
|
||||
inner += `<div class="section-title">交易所持仓 · ${pos.length} 仓</div>`;
|
||||
if (pos.length) {
|
||||
inner += renderGridPositionsTable(
|
||||
@@ -2353,10 +2363,7 @@
|
||||
html += `<div class="err">${esc(row.error || ag.error || "子代理不可用")}</div>`;
|
||||
return html;
|
||||
}
|
||||
html += `<div class="stat-row">
|
||||
<div class="stat-box"><div class="stat-label">余额</div><div class="stat-value">${fmt(ag.balance_usdt, 2)} U</div></div>
|
||||
<div class="stat-box"><div class="stat-label">浮盈合计</div><div class="stat-value ${pnlCls(ag.total_unrealized_pnl)}">${fmt(ag.total_unrealized_pnl, 2)}</div></div>
|
||||
</div>`;
|
||||
html += renderAccountStatRow(row, ag);
|
||||
const posCount = pos.length;
|
||||
const posListCls = hubPosListCountClass(posCount);
|
||||
html += `<div class="section-title">持仓(${posCount} 仓 · 每币种一卡)</div>`;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Orbitron:wght@500;600;700&display=swap" rel="stylesheet" media="print" onload="this.media='all'" />
|
||||
<noscript><link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Orbitron:wght@500;600;700&display=swap" rel="stylesheet" /></noscript>
|
||||
<link rel="stylesheet" href="/assets/app.css?v=20260607-hub-ai-v6" />
|
||||
<link rel="stylesheet" href="/assets/app.css?v=20260607-hub-board-v1" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="app-bg" aria-hidden="true"></div>
|
||||
@@ -295,6 +295,6 @@
|
||||
<script src="https://unpkg.com/lightweight-charts@4.2.0/dist/lightweight-charts.standalone.production.js"></script>
|
||||
<script src="/assets/chart.js?v=20260604-upnl-contracts"></script>
|
||||
<script src="/assets/ai_review_render.js?v=2"></script>
|
||||
<script src="/assets/app.js?v=20260607-hub-ai-v2"></script>
|
||||
<script src="/assets/app.js?v=20260607-hub-board-v1"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user