Push merge conflict

This commit is contained in:
2025-07-04 11:02:53 +07:00
parent 88f195c0ca
commit 59c5de7df7
27 changed files with 1133 additions and 1118 deletions

View File

@@ -224,7 +224,6 @@ public class BotController : BaseController
Timeframe = request.Config.Timeframe,
IsForWatchingOnly = request.Config.IsForWatchingOnly,
BotTradingBalance = request.Config.BotTradingBalance,
BotType = request.Config.BotType,
CooldownPeriod = request.Config.CooldownPeriod,
MaxLossStreak = request.Config.MaxLossStreak,
MaxPositionTimeHours = request.Config.MaxPositionTimeHours,
@@ -236,7 +235,7 @@ public class BotController : BaseController
UseForDynamicStopLoss = request.Config.UseForDynamicStopLoss,
// Set computed/default properties
IsForBacktest = false,
FlipPosition = request.Config.BotType == BotType.FlippingBot,
FlipPosition = request.Config.FlipPosition,
Name = request.Config.Name
};
@@ -256,12 +255,11 @@ public class BotController : BaseController
/// <summary>
/// Stops a bot specified by type and name.
/// </summary>
/// <param name="botType">The type of the bot to stop.</param>
/// <param name="identifier">The identifier of the bot to stop.</param>
/// <returns>A string indicating the result of the stop operation.</returns>
[HttpGet]
[Route("Stop")]
public async Task<ActionResult<string>> Stop(BotType botType, string identifier)
public async Task<ActionResult<string>> Stop(string identifier)
{
try
{
@@ -271,8 +269,8 @@ public class BotController : BaseController
return Forbid("You don't have permission to stop this bot");
}
var result = await _mediator.Send(new StopBotCommand(botType, identifier));
_logger.LogInformation($"{botType} type with identifier {identifier} is now {result}");
var result = await _mediator.Send(new StopBotCommand(identifier));
_logger.LogInformation($"Bot identifier {identifier} is now {result}");
await NotifyBotSubscriberAsync();
@@ -343,7 +341,7 @@ public class BotController : BaseController
foreach (var bot in userBots)
{
await _mediator.Send(new StopBotCommand(bot.Config.BotType, bot.Identifier));
await _mediator.Send(new StopBotCommand(bot.Identifier));
await _hubContext.Clients.All.SendAsync("SendNotification",
$"Bot {bot.Identifier} paused by {user.Name}.", "Info");
}
@@ -422,7 +420,8 @@ public class BotController : BaseController
{
// We can't directly restart a bot with just BotType and Name
// Instead, stop the bot and then retrieve the backup to start it again
await _mediator.Send(new StopBotCommand(bot.Config.BotType, bot.Identifier));
await _mediator.Send(
new StopBotCommand(bot.Identifier));
// Get the saved bot backup
var backup = _botService.GetBotBackup(bot.Identifier);
@@ -776,7 +775,6 @@ public class BotController : BaseController
Timeframe = request.Config.Timeframe,
IsForWatchingOnly = request.Config.IsForWatchingOnly,
BotTradingBalance = request.Config.BotTradingBalance,
BotType = request.Config.BotType,
CooldownPeriod = request.Config.CooldownPeriod,
MaxLossStreak = request.Config.MaxLossStreak,
MaxPositionTimeHours = request.Config.MaxPositionTimeHours,
@@ -788,7 +786,7 @@ public class BotController : BaseController
UseForDynamicStopLoss = request.Config.UseForDynamicStopLoss,
// Set computed/default properties
IsForBacktest = false,
FlipPosition = request.Config.BotType == BotType.FlippingBot,
FlipPosition = request.Config.FlipPosition,
Name = request.Config.Name
};