diff --git a/web/src/components/terminal/TerminalDashboard.tsx b/web/src/components/terminal/TerminalDashboard.tsx index 82d6855a..151ec58d 100644 --- a/web/src/components/terminal/TerminalDashboard.tsx +++ b/web/src/components/terminal/TerminalDashboard.tsx @@ -83,6 +83,18 @@ function fmtTime(raw?: string | number): string { return Number.isNaN(d.getTime()) ? '' : d.toLocaleString('en-GB', { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', hour12: false }) } +/** Hold duration from entry/exit epoch-ms as a compact 45m / 2h10 / 1d3h. */ +function fmtHold(entry?: number, exit?: number): string { + if (!entry || !exit || exit <= entry) return '—' + const mins = Math.round((exit - entry) / 60000) + if (mins < 60) return `${mins}m` + const h = Math.floor(mins / 60) + const m = mins % 60 + if (h < 24) return m ? `${h}h${m}` : `${h}h` + const d = Math.floor(h / 24) + return `${d}d${h % 24}h` +} + function useTick(ms = 1000) { const [, set] = useState(0) useEffect(() => { @@ -537,10 +549,19 @@ export function TerminalDashboard({
Recent trades - Recent closes · symbol/side/time/pnl + Recent closes · symbol/side/hold/pnl
{recentTrades.length > 0 ? ( + + + + + + + + + {recentTrades.map((p) => { const win = p.realized_pnl >= 0 @@ -548,7 +569,8 @@ export function TerminalDashboard({ - + + )
symbolsidehold closedPnL
{baseLabel(p.symbol)} {p.side.toLowerCase()}{fmtTime(p.exit_time)}{fmtHold(p.entry_time, p.exit_time)}{fmtTime(p.exit_time)} {fmtUsd(p.realized_pnl, true)}