diff --git a/web/src/components/terminal/TerminalDashboard.tsx b/web/src/components/terminal/TerminalDashboard.tsx index 5904e53f..82d6855a 100644 --- a/web/src/components/terminal/TerminalDashboard.tsx +++ b/web/src/components/terminal/TerminalDashboard.tsx @@ -53,6 +53,12 @@ function fmtPct(n: number | undefined): string { if (n == null || Number.isNaN(n)) return '—' return `${n >= 0 ? '+' : ''}${n.toFixed(2)}%` } +/** Price with magnitude-aware precision: 64,416 · 184.2 · 2.3775 · 0.0067 */ +function fmtPx(n: number | undefined): string { + if (n == null || Number.isNaN(n) || n === 0) return '—' + const dp = n >= 1000 ? 0 : n >= 100 ? 1 : n >= 1 ? 2 : 4 + return n.toLocaleString('en-US', { minimumFractionDigits: dp, maximumFractionDigits: dp }) +} function baseLabel(raw?: string): string { if (!raw) return '' return raw.toUpperCase().replace(/^XYZ:/, '').replace(/[-_]/g, '').replace(/(USDT|USDC|USD)$/, '') @@ -500,8 +506,9 @@ export function TerminalDashboard({ symbol - side - lev + side·lev + entry + size PnL return% @@ -510,11 +517,13 @@ export function TerminalDashboard({ {positions.map((p, i) => { const long = /long|buy/i.test(p.side) const win = (p.unrealized_pnl ?? 0) >= 0 + const notional = Math.abs(p.quantity ?? 0) * (p.mark_price || p.entry_price || 0) return ( {baseLabel(p.symbol)} - {long ? 'long' : 'short'} - {p.leverage}× + {long ? 'long' : 'short'} {p.leverage}× + {fmtPx(p.entry_price)} + {fmtUsd(notional)} {fmtUsd(p.unrealized_pnl, true)} {(p.unrealized_pnl_pct ?? 0).toFixed(2)}%