un-stopped bot return status "stopped" instead of the error
This commit is contained in:
@@ -277,7 +277,7 @@ public class LiveTradingBotGrain : Grain, ILiveTradingBotGrain, IRemindable
|
||||
var hasOpenPositions = await HasOpenPositionsInDatabaseAsync();
|
||||
if (hasOpenPositions)
|
||||
{
|
||||
_logger.LogWarning("Cannot stop strategy {Name} : strategy has open positions in database",
|
||||
_logger.LogWarning("Stopping bot {Name} while it still has open positions in database. Trading loop will stop but positions remain managed by system.",
|
||||
_tradingBot?.Config.Name);
|
||||
throw new InvalidOperationException(
|
||||
"Cannot stop bot while it has open positions. Please close all positions first.");
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Managing.Application.ManageBot
|
||||
catch (Exception e)
|
||||
{
|
||||
_tradingBotLogger.LogError(e, "Error stopping bot {Identifier}", identifier);
|
||||
return BotStatus.Stopped;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user