Optionnal cooldown
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using Managing.Api.Models.Requests;
|
using Managing.Api.Models.Requests;
|
||||||
using Managing.Application.Abstractions;
|
|
||||||
using Managing.Application.Abstractions.Services;
|
using Managing.Application.Abstractions.Services;
|
||||||
using Managing.Application.Hubs;
|
using Managing.Application.Hubs;
|
||||||
using Managing.Domain.Backtests;
|
using Managing.Domain.Backtests;
|
||||||
@@ -372,7 +371,7 @@ public class BacktestController : BaseController
|
|||||||
IsForWatchingOnly = request.Config.IsForWatchingOnly,
|
IsForWatchingOnly = request.Config.IsForWatchingOnly,
|
||||||
BotTradingBalance = request.Config.BotTradingBalance,
|
BotTradingBalance = request.Config.BotTradingBalance,
|
||||||
IsForBacktest = true,
|
IsForBacktest = true,
|
||||||
CooldownPeriod = request.Config.CooldownPeriod,
|
CooldownPeriod = request.Config.CooldownPeriod ?? 1,
|
||||||
MaxLossStreak = request.Config.MaxLossStreak,
|
MaxLossStreak = request.Config.MaxLossStreak,
|
||||||
MaxPositionTimeHours = request.Config.MaxPositionTimeHours,
|
MaxPositionTimeHours = request.Config.MaxPositionTimeHours,
|
||||||
FlipOnlyWhenInProfit = request.Config.FlipOnlyWhenInProfit,
|
FlipOnlyWhenInProfit = request.Config.FlipOnlyWhenInProfit,
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ public class BotController : BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
var result = await _mediator.Send(new StopAllUserBotsCommand(user));
|
var result = await _mediator.Send(new StopAllUserBotsCommand(user));
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
await NotifyBotSubscriberAsync();
|
await NotifyBotSubscriberAsync();
|
||||||
@@ -724,7 +724,7 @@ public class BotController : BaseController
|
|||||||
Timeframe = request.Config.Timeframe,
|
Timeframe = request.Config.Timeframe,
|
||||||
IsForWatchingOnly = request.Config.IsForWatchingOnly,
|
IsForWatchingOnly = request.Config.IsForWatchingOnly,
|
||||||
BotTradingBalance = request.Config.BotTradingBalance,
|
BotTradingBalance = request.Config.BotTradingBalance,
|
||||||
CooldownPeriod = request.Config.CooldownPeriod,
|
CooldownPeriod = request.Config.CooldownPeriod ?? 1,
|
||||||
MaxLossStreak = request.Config.MaxLossStreak,
|
MaxLossStreak = request.Config.MaxLossStreak,
|
||||||
MaxPositionTimeHours = request.Config.MaxPositionTimeHours,
|
MaxPositionTimeHours = request.Config.MaxPositionTimeHours,
|
||||||
FlipOnlyWhenInProfit = request.Config.FlipOnlyWhenInProfit,
|
FlipOnlyWhenInProfit = request.Config.FlipOnlyWhenInProfit,
|
||||||
@@ -886,7 +886,7 @@ public class BotController : BaseController
|
|||||||
Timeframe = request.Config.Timeframe,
|
Timeframe = request.Config.Timeframe,
|
||||||
IsForWatchingOnly = request.Config.IsForWatchingOnly,
|
IsForWatchingOnly = request.Config.IsForWatchingOnly,
|
||||||
BotTradingBalance = request.Config.BotTradingBalance,
|
BotTradingBalance = request.Config.BotTradingBalance,
|
||||||
CooldownPeriod = request.Config.CooldownPeriod,
|
CooldownPeriod = request.Config.CooldownPeriod ?? 1,
|
||||||
MaxLossStreak = request.Config.MaxLossStreak,
|
MaxLossStreak = request.Config.MaxLossStreak,
|
||||||
MaxPositionTimeHours = request.Config.MaxPositionTimeHours,
|
MaxPositionTimeHours = request.Config.MaxPositionTimeHours,
|
||||||
FlipOnlyWhenInProfit = request.Config.FlipOnlyWhenInProfit,
|
FlipOnlyWhenInProfit = request.Config.FlipOnlyWhenInProfit,
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ public class BundleBacktestWorker : BaseWorker<BundleBacktestWorker>
|
|||||||
IsForWatchingOnly = runBacktestRequest.Config.IsForWatchingOnly,
|
IsForWatchingOnly = runBacktestRequest.Config.IsForWatchingOnly,
|
||||||
BotTradingBalance = runBacktestRequest.Config.BotTradingBalance,
|
BotTradingBalance = runBacktestRequest.Config.BotTradingBalance,
|
||||||
IsForBacktest = true,
|
IsForBacktest = true,
|
||||||
CooldownPeriod = runBacktestRequest.Config.CooldownPeriod,
|
CooldownPeriod = runBacktestRequest.Config.CooldownPeriod ?? 1,
|
||||||
MaxLossStreak = runBacktestRequest.Config.MaxLossStreak,
|
MaxLossStreak = runBacktestRequest.Config.MaxLossStreak,
|
||||||
MaxPositionTimeHours = runBacktestRequest.Config.MaxPositionTimeHours,
|
MaxPositionTimeHours = runBacktestRequest.Config.MaxPositionTimeHours,
|
||||||
FlipOnlyWhenInProfit = runBacktestRequest.Config.FlipOnlyWhenInProfit,
|
FlipOnlyWhenInProfit = runBacktestRequest.Config.FlipOnlyWhenInProfit,
|
||||||
|
|||||||
@@ -50,13 +50,11 @@ public class TradingBotConfigRequest
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cooldown period between trades (in candles)
|
/// Cooldown period between trades (in candles)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
public int? CooldownPeriod { get; set; }
|
||||||
public int CooldownPeriod { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maximum consecutive losses before stopping the bot
|
/// Maximum consecutive losses before stopping the bot
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
|
||||||
public int MaxLossStreak { get; set; }
|
public int MaxLossStreak { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -4073,8 +4073,8 @@ export interface TradingBotConfigRequest {
|
|||||||
botTradingBalance: number;
|
botTradingBalance: number;
|
||||||
name: string;
|
name: string;
|
||||||
flipPosition: boolean;
|
flipPosition: boolean;
|
||||||
cooldownPeriod: number;
|
cooldownPeriod?: number;
|
||||||
maxLossStreak: number;
|
maxLossStreak?: number;
|
||||||
scenario?: ScenarioRequest | null;
|
scenario?: ScenarioRequest | null;
|
||||||
scenarioName?: string | null;
|
scenarioName?: string | null;
|
||||||
moneyManagementName?: string | null;
|
moneyManagementName?: string | null;
|
||||||
|
|||||||
@@ -556,8 +556,8 @@ export interface TradingBotConfigRequest {
|
|||||||
botTradingBalance: number;
|
botTradingBalance: number;
|
||||||
name: string;
|
name: string;
|
||||||
flipPosition: boolean;
|
flipPosition: boolean;
|
||||||
cooldownPeriod: number;
|
cooldownPeriod?: number;
|
||||||
maxLossStreak: number;
|
maxLossStreak?: number;
|
||||||
scenario?: ScenarioRequest | null;
|
scenario?: ScenarioRequest | null;
|
||||||
scenarioName?: string | null;
|
scenarioName?: string | null;
|
||||||
moneyManagementName?: string | null;
|
moneyManagementName?: string | null;
|
||||||
|
|||||||
Reference in New Issue
Block a user