Fix bot TOP 3
This commit is contained in:
@@ -239,4 +239,32 @@ public class PostgreSqlBotRepository : IBotRepository
|
||||
var bots = PostgreSqlMappers.Map(entities);
|
||||
return (bots, totalCount);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Bot>> GetTopBotsByPnLAsync(IEnumerable<BotStatus> statuses, int count = 3)
|
||||
{
|
||||
var entities = await _context.Bots
|
||||
.AsNoTracking()
|
||||
.Include(m => m.User)
|
||||
.Where(b => statuses.Contains(b.Status))
|
||||
.OrderByDescending(b => b.Pnl)
|
||||
.Take(count)
|
||||
.ToListAsync()
|
||||
.ConfigureAwait(false);
|
||||
|
||||
return PostgreSqlMappers.Map(entities);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Bot>> GetTopBotsByRoiAsync(IEnumerable<BotStatus> statuses, int count = 3)
|
||||
{
|
||||
var entities = await _context.Bots
|
||||
.AsNoTracking()
|
||||
.Include(m => m.User)
|
||||
.Where(b => statuses.Contains(b.Status))
|
||||
.OrderByDescending(b => b.Roi)
|
||||
.Take(count)
|
||||
.ToListAsync()
|
||||
.ConfigureAwait(false);
|
||||
|
||||
return PostgreSqlMappers.Map(entities);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user