This commit is contained in:
2025-06-05 01:17:15 +07:00
parent 973a8c7c61
commit 6441687df3
12 changed files with 281 additions and 198 deletions

View File

@@ -73,7 +73,7 @@ namespace Managing.Application.ManageBot
MaxLossStreak = request.Config.MaxLossStreak,
MaxPositionTimeHours = request.Config.MaxPositionTimeHours, // Properly handle nullable value
FlipOnlyWhenInProfit = request.Config.FlipOnlyWhenInProfit,
FlipPosition = request.Config.FlipPosition,
FlipPosition = request.Config.BotType == BotType.FlippingBot, // Set FlipPosition based on BotType
Name = request.Config.Name ?? request.Name,
CloseEarlyWhenProfitable = request.Config.CloseEarlyWhenProfitable
};
@@ -87,24 +87,15 @@ namespace Managing.Application.ManageBot
return bot.GetStatus();
case BotType.ScalpingBot:
var sBot = _botFactory.CreateScalpingBot(configToUse);
sBot.User = request.User;
// Log the configuration being used
await LogBotConfigurationAsync(sBot, "ScalpingBot created");
_botService.AddTradingBotToCache(sBot);
return sBot.GetStatus();
case BotType.FlippingBot:
var fBot = _botFactory.CreateFlippingBot(configToUse);
fBot.User = request.User;
var tradingBot = _botFactory.CreateTradingBot(configToUse);
tradingBot.User = request.User;
// Log the configuration being used
await LogBotConfigurationAsync(fBot, "FlippingBot created");
await LogBotConfigurationAsync(tradingBot, $"{configToUse.BotType} created");
_botService.AddTradingBotToCache(fBot);
return fBot.GetStatus();
_botService.AddTradingBotToCache(tradingBot);
return tradingBot.GetStatus();
}
return botStatus.ToString();
@@ -127,6 +118,7 @@ namespace Managing.Application.ManageBot
$"Balance: {config.BotTradingBalance}, " +
$"MaxTime: {config.MaxPositionTimeHours?.ToString() ?? "Disabled"}, " +
$"FlipOnlyProfit: {config.FlipOnlyWhenInProfit}, " +
$"FlipPosition: {config.FlipPosition}, " +
$"Cooldown: {config.CooldownPeriod}, " +
$"MaxLoss: {config.MaxLossStreak}";