Prevent user to open multiple strategy on the same ticker
This commit is contained in:
@@ -43,6 +43,15 @@ namespace Managing.Application.ManageBot
|
||||
$"Bot trading balance must be greater than {Constants.GMX.Config.MinimumPositionAmount}");
|
||||
}
|
||||
|
||||
// Check if user already has a bot on this ticker
|
||||
var hasExistingBotOnTicker = await _botService.HasUserBotOnTickerAsync(request.User.Id, request.Config.Ticker);
|
||||
if (hasExistingBotOnTicker)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"You already have a strategy running or saved on ticker {request.Config.Ticker}. " +
|
||||
"You cannot create multiple strategies on the same ticker.");
|
||||
}
|
||||
|
||||
Account account;
|
||||
if (string.IsNullOrEmpty(request.Config.AccountName))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user