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 (
@@ -488,13 +499,13 @@ function TradeDetailModal({ trade, orders, onClose }) {

多仓 {trade.LongExchange || '-'}

入场价${(trade.LongEntry || 0).toFixed(6)}
出场价${(trade.LongExit || 0).toFixed(6)}
-
盈亏 0 ? 'text-green' : trade.LongPnl < 0 ? 'text-red' : '')}>{trade.LongPnl != null ? trade.LongPnl.toFixed(4) + '%' : '-'}
+
盈亏 0 ? 'text-green' : trade.LongPnl < 0 ? 'text-red' : '')}>{trade.LongPnl != null ? trade.LongPnl.toFixed(4) + '%' : '-'} {longPnlUSD != null ? (${longPnlUSD.toFixed(4)}) : null}

空仓 {trade.ShortExchange || '-'}

入场价${(trade.ShortEntry || 0).toFixed(6)}
出场价${(trade.ShortExit || 0).toFixed(6)}
-
盈亏 0 ? 'text-green' : trade.ShortPnl < 0 ? 'text-red' : '')}>{trade.ShortPnl != null ? trade.ShortPnl.toFixed(4) + '%' : '-'}
+
盈亏 0 ? 'text-green' : trade.ShortPnl < 0 ? 'text-red' : '')}>{trade.ShortPnl != null ? trade.ShortPnl.toFixed(4) + '%' : '-'} {shortPnlUSD != null ? (${shortPnlUSD.toFixed(4)}) : null}

净收益

@@ -509,16 +520,16 @@ function TradeDetailModal({ trade, orders, onClose }) {

订单明细 ({orders.length})

- + - {orders.map((o, i) => ( + {sortedOrders.map((o, i) => ( + - - +
类型方向交易所价格数量手续费订单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) + '...' : '-'}