diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index a0a2ed1..5f2cd7a 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -448,6 +448,17 @@ function TradeDetailModal({ trade, orders, onClose }) { const dur = closed ? Math.round((closed - opened) / 1000) + 's' : '-' const pnlCls = trade.NetPnl > 0 ? 'text-green' : trade.NetPnl < 0 ? 'text-red' : '' + // Sort orders: by Exchange ascending, then by CreatedAt ascending + const sortedOrders = [...(orders || [])].sort((a, b) => { + const exCmp = (a.Exchange || '').localeCompare(b.Exchange || '') + if (exCmp !== 0) return exCmp + return new Date(a.CreatedAt) - new Date(b.CreatedAt) + }) + + // Compute USD PnL per leg: AmountUSD * Pnl% / 100 + const longPnlUSD = trade.AmountUSD && trade.LongPnl != null ? trade.AmountUSD * trade.LongPnl / 100 : null + const shortPnlUSD = trade.AmountUSD && trade.ShortPnl != null ? trade.AmountUSD * trade.ShortPnl / 100 : null + return (
| 类型 | 方向 | 交易所 | 价格 | 数量 | 手续费 | 订单ID | ||
|---|---|---|---|---|---|---|---|---|
| 交易所 | 类型 | 方向 | 价格 | 仓位 | 手续费 | 订单ID | ||
| {o.Exchange} | {o.Type === 'entry' ? '开仓' : o.Type === 'exit' ? '平仓' : o.Type === 'scale' ? '加仓' : o.Type} | {o.Side === 'buy' ? '买' : '卖'} | -{o.Exchange} | ${(o.Price || 0).toFixed(6)} | -{o.Size || '-'} | +{o.Size != null ? Number(o.Size).toFixed(4) : '-'} | {o.Fee != null ? '$' + (o.Fee).toFixed(4) : '-'} | {o.OrderID ? o.OrderID.substring(0, 12) + '...' : '-'} |