Implement profitable bots filtering in BotController and DataController

- Added IConfiguration dependency to BotController for accessing environment variables.
- Updated GetBotsPaginatedAsync method in BotService and IBotService to include a flag for filtering profitable bots.
- Modified DataController to utilize the new filtering option for agent summaries and bot retrieval.
- Enhanced PostgreSqlBotRepository to apply filtering based on profitability when querying bots.
This commit is contained in:
2025-11-22 14:02:29 +07:00
parent e69dd43ace
commit 2a354bd7d2
6 changed files with 42 additions and 18 deletions

View File

@@ -48,6 +48,7 @@ public interface IBotService
/// <param name="agentName">Filter by agent name (partial match, case-insensitive)</param>
/// <param name="sortBy">Sort field</param>
/// <param name="sortDirection">Sort direction ("Asc" or "Desc")</param>
/// <param name="showOnlyProfitable">Whether to show only profitable bots (ROI > 0)</param>
/// <returns>Tuple containing the bots for the current page and total count</returns>
Task<(IEnumerable<Bot> Bots, int TotalCount)> GetBotsPaginatedAsync(
int pageNumber,
@@ -57,7 +58,8 @@ public interface IBotService
string? ticker = null,
string? agentName = null,
BotSortableColumn sortBy = BotSortableColumn.CreateDate,
string sortDirection = "Desc");
string sortDirection = "Desc",
bool showOnlyProfitable = false);
/// <summary>
/// Checks USDC and ETH balances for EVM/GMX V2 accounts

View File

@@ -460,7 +460,8 @@ namespace Managing.Application.ManageBot
string? ticker = null,
string? agentName = null,
BotSortableColumn sortBy = BotSortableColumn.CreateDate,
string sortDirection = "Desc")
string sortDirection = "Desc",
bool showOnlyProfitable = false)
{
return await ServiceScopeHelpers.WithScopedService<IBotRepository, (IEnumerable<Bot> Bots, int TotalCount)>(
_scopeFactory,
@@ -474,7 +475,8 @@ namespace Managing.Application.ManageBot
ticker,
agentName,
sortBy,
sortDirection);
sortDirection,
showOnlyProfitable);
});
}