Prevent user to open multiple strategy on the same ticker
This commit is contained in:
@@ -72,6 +72,15 @@ namespace Managing.Application.ManageBot
|
||||
throw new InvalidOperationException($"Could not retrieve configuration for master bot {request.MasterBotIdentifier}");
|
||||
}
|
||||
|
||||
// Check if user already has a bot on this ticker (same as master bot)
|
||||
var hasExistingBotOnTicker = await _botService.HasUserBotOnTickerAsync(request.User.Id, masterConfig.Ticker);
|
||||
if (hasExistingBotOnTicker)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"You already have a strategy running or saved on ticker {masterConfig.Ticker}. " +
|
||||
"You cannot create multiple strategies on the same ticker.");
|
||||
}
|
||||
|
||||
// Get account information from the requesting user's accounts
|
||||
var userAccounts = await _accountService.GetAccountsByUserAsync(request.User, true, true);
|
||||
var firstAccount = userAccounts.FirstOrDefault();
|
||||
|
||||
Reference in New Issue
Block a user