Implement WinRate, Bankroll, Positions UI and add Trades30d to Analytics

This commit is contained in:
Richard
2026-07-09 12:44:32 +02:00
parent 3b11b71188
commit 7964194e9e
16 changed files with 1318 additions and 28 deletions
@@ -155,4 +155,14 @@ public class TraderRepository : ITraderRepository
.Take(take)
.ToListAsync(ct);
}
public async Task<IReadOnlyList<TraderPosition>> GetPositionsAsync(int traderId, CancellationToken ct = default)
{
return await _db.TraderPositions
.Include(p => p.MarketOutcome)
.ThenInclude(o => o.Market)
.Where(p => p.TraderId == traderId && (p.SharesHeld > 0 || p.RealizedPnl != 0))
.OrderByDescending(p => p.LastTradeExecutedAt ?? DateTime.MinValue)
.ToListAsync(ct);
}
}