Optionnal cooldown

This commit is contained in:
2025-09-12 00:12:48 +07:00
parent cb6778d9a0
commit da50b30344
6 changed files with 10 additions and 13 deletions

View File

@@ -1,6 +1,5 @@
using System.Text.Json;
using Managing.Api.Models.Requests;
using Managing.Application.Abstractions;
using Managing.Application.Abstractions.Services;
using Managing.Application.Hubs;
using Managing.Domain.Backtests;
@@ -372,7 +371,7 @@ public class BacktestController : BaseController
IsForWatchingOnly = request.Config.IsForWatchingOnly,
BotTradingBalance = request.Config.BotTradingBalance,
IsForBacktest = true,
CooldownPeriod = request.Config.CooldownPeriod,
CooldownPeriod = request.Config.CooldownPeriod ?? 1,
MaxLossStreak = request.Config.MaxLossStreak,
MaxPositionTimeHours = request.Config.MaxPositionTimeHours,
FlipOnlyWhenInProfit = request.Config.FlipOnlyWhenInProfit,

View File

@@ -218,7 +218,7 @@ public class BotController : BaseController
}
var result = await _mediator.Send(new StopAllUserBotsCommand(user));
if (result)
{
await NotifyBotSubscriberAsync();
@@ -724,7 +724,7 @@ public class BotController : BaseController
Timeframe = request.Config.Timeframe,
IsForWatchingOnly = request.Config.IsForWatchingOnly,
BotTradingBalance = request.Config.BotTradingBalance,
CooldownPeriod = request.Config.CooldownPeriod,
CooldownPeriod = request.Config.CooldownPeriod ?? 1,
MaxLossStreak = request.Config.MaxLossStreak,
MaxPositionTimeHours = request.Config.MaxPositionTimeHours,
FlipOnlyWhenInProfit = request.Config.FlipOnlyWhenInProfit,
@@ -886,7 +886,7 @@ public class BotController : BaseController
Timeframe = request.Config.Timeframe,
IsForWatchingOnly = request.Config.IsForWatchingOnly,
BotTradingBalance = request.Config.BotTradingBalance,
CooldownPeriod = request.Config.CooldownPeriod,
CooldownPeriod = request.Config.CooldownPeriod ?? 1,
MaxLossStreak = request.Config.MaxLossStreak,
MaxPositionTimeHours = request.Config.MaxPositionTimeHours,
FlipOnlyWhenInProfit = request.Config.FlipOnlyWhenInProfit,

View File

@@ -256,7 +256,7 @@ public class BundleBacktestWorker : BaseWorker<BundleBacktestWorker>
IsForWatchingOnly = runBacktestRequest.Config.IsForWatchingOnly,
BotTradingBalance = runBacktestRequest.Config.BotTradingBalance,
IsForBacktest = true,
CooldownPeriod = runBacktestRequest.Config.CooldownPeriod,
CooldownPeriod = runBacktestRequest.Config.CooldownPeriod ?? 1,
MaxLossStreak = runBacktestRequest.Config.MaxLossStreak,
MaxPositionTimeHours = runBacktestRequest.Config.MaxPositionTimeHours,
FlipOnlyWhenInProfit = runBacktestRequest.Config.FlipOnlyWhenInProfit,

View File

@@ -50,13 +50,11 @@ public class TradingBotConfigRequest
/// <summary>
/// Cooldown period between trades (in candles)
/// </summary>
[Required]
public int CooldownPeriod { get; set; }
public int? CooldownPeriod { get; set; }
/// <summary>
/// Maximum consecutive losses before stopping the bot
/// </summary>
[Required]
public int MaxLossStreak { get; set; }
/// <summary>

View File

@@ -4073,8 +4073,8 @@ export interface TradingBotConfigRequest {
botTradingBalance: number;
name: string;
flipPosition: boolean;
cooldownPeriod: number;
maxLossStreak: number;
cooldownPeriod?: number;
maxLossStreak?: number;
scenario?: ScenarioRequest | null;
scenarioName?: string | null;
moneyManagementName?: string | null;

View File

@@ -556,8 +556,8 @@ export interface TradingBotConfigRequest {
botTradingBalance: number;
name: string;
flipPosition: boolean;
cooldownPeriod: number;
maxLossStreak: number;
cooldownPeriod?: number;
maxLossStreak?: number;
scenario?: ScenarioRequest | null;
scenarioName?: string | null;
moneyManagementName?: string | null;