Block user to create strategy with over allocation
This commit is contained in:
@@ -72,6 +72,14 @@ namespace Managing.Application.ManageBot
|
||||
}
|
||||
}
|
||||
|
||||
// Enforce allocation limit across all bots using the same account
|
||||
var availableAllocation = await _botService.GetAvailableAllocationUsdAsync(account, default);
|
||||
if (request.Config.BotTradingBalance > availableAllocation)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"Insufficient available allocation on account '{account.Name}'. Requested: {request.Config.BotTradingBalance:F2} USDC, Available: {availableAllocation:F2} USDC.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var botGrain = _grainFactory.GetGrain<ILiveTradingBotGrain>(Guid.NewGuid());
|
||||
|
||||
Reference in New Issue
Block a user