Fix spot bot

This commit is contained in:
2025-12-04 21:21:48 +07:00
parent a07d7ede18
commit b44e1f66a7
13 changed files with 117 additions and 47 deletions

View File

@@ -255,7 +255,7 @@ public class BotController : BaseController
catch (Exception ex)
{
_logger.LogError(ex, "Error stopping bot {Identifier}", identifier);
// Check if this is an Orleans exception that wasn't caught earlier
if (OrleansExceptionHelper.IsOrleansException(ex))
{
@@ -265,7 +265,7 @@ public class BotController : BaseController
identifier, ex.GetType().Name);
return StatusCode(503, userMessage);
}
return StatusCode(500, $"Error stopping bot: {ex.Message}");
}
}
@@ -814,7 +814,7 @@ public class BotController : BaseController
UseForSignalFiltering = request.Config.UseForSignalFiltering,
UseForDynamicStopLoss = request.Config.UseForDynamicStopLoss,
// Set computed/default properties
TradingType = TradingType.Futures,
TradingType = request.Config.TradingType,
FlipPosition = request.Config.FlipPosition,
Name = request.Config.Name
};
@@ -955,6 +955,13 @@ public class BotController : BaseController
}
}
var tradingType = request.Config.TradingType switch
{
TradingType.BacktestFutures => TradingType.Futures,
TradingType.BacktestSpot => TradingType.Spot,
_ => TradingType.Futures
};
// Map the request to the full TradingBotConfig
var config = new TradingBotConfig
{
@@ -976,9 +983,9 @@ public class BotController : BaseController
UseForSignalFiltering = request.Config.UseForSignalFiltering,
UseForDynamicStopLoss = request.Config.UseForDynamicStopLoss,
// Set computed/default properties
TradingType = TradingType.Futures,
FlipPosition = request.Config.FlipPosition,
Name = request.Config.Name
Name = request.Config.Name,
TradingType = tradingType
};
return (config, user);