Retrieve aggregated performance statistics for each trading variant
SELECT * FROM "Models" WHERE variant = ?)WHERE status = 'CLOSED' AND modelId IN (...))totalTrades: Count of closed orderswinRate: (wins / totalTrades) * 100 where wins = orders with realizedPnl > 0totalPnl: Sum of all realizedPnl valuesavgPnl: totalPnl / totalTradesmodelCount: Count of active models0models.variant and orders.statusPromise.all()ANY(modelIds)) for efficient filtering2 × number of variants (currently 8 queries)Promise.all()Win Rate
(winning_trades / total_trades) × 100Interpretation:> 55%: Strong performance50-55%: Moderate performance< 50%: UnderperformingAverage P&L
total_pnl / total_tradesInterpretation:> 0: Profitable on average< 0: Losing on averageModel Count