Block user to create strategy with over allocation

This commit is contained in:
2025-10-03 16:14:24 +07:00
parent 83ee4f633c
commit 6928770da7
3 changed files with 80 additions and 0 deletions

View File

@@ -26,6 +26,16 @@ public interface IBotService
Task<bool> UpdateBotStatisticsAsync(Guid identifier);
Task<bool> SaveBotStatisticsAsync(Bot bot);
/// <summary>
/// Computes the remaining available USDC allocation for the provided account,
/// subtracting the sum of BotTradingBalance from other bots using the same account.
/// Optionally exclude a specific bot identifier from the allocation sum (useful for restarts/updates).
/// </summary>
/// <param name="account">Target account.</param>
/// <param name="excludeIdentifier">Bot identifier to exclude from allocation sum.</param>
/// <returns>Available USDC amount that can be allocated.</returns>
Task<decimal> GetAvailableAllocationUsdAsync(Account account, Guid excludeIdentifier = default);
/// <summary>
/// Gets paginated bots with filtering and sorting
/// </summary>