Prevent user to open multiple strategy on the same ticker
This commit is contained in:
@@ -139,6 +139,11 @@ public class BotController : BaseController
|
||||
await NotifyBotSubscriberAsync();
|
||||
return Ok(result);
|
||||
}
|
||||
catch (InvalidOperationException ex) when (ex.Message.Contains("already have a strategy"))
|
||||
{
|
||||
// Return 400 for validation errors about existing strategies on same ticker
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error starting bot");
|
||||
@@ -168,6 +173,11 @@ public class BotController : BaseController
|
||||
await NotifyBotSubscriberAsync();
|
||||
return Ok(result);
|
||||
}
|
||||
catch (InvalidOperationException ex) when (ex.Message.Contains("already have a strategy"))
|
||||
{
|
||||
// Return 400 for validation errors about existing strategies on same ticker
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error starting copy trading bot");
|
||||
@@ -192,6 +202,11 @@ public class BotController : BaseController
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
catch (InvalidOperationException ex) when (ex.Message.Contains("already have a strategy"))
|
||||
{
|
||||
// Return 400 for validation errors about existing strategies on same ticker
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error saving bot");
|
||||
@@ -319,6 +334,11 @@ public class BotController : BaseController
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
catch (InvalidOperationException ex) when (ex.Message.Contains("already have another strategy"))
|
||||
{
|
||||
// Return 400 for validation errors about existing strategies on same ticker
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error restarting bot");
|
||||
|
||||
Reference in New Issue
Block a user