Fixes for bots running (#22)

* Fixes for bots running

* Up botmanager

* Add cooldown

* Refact can open position

* Add cooldown Period and MaxLossStreak

* Add agentName

* Add env variable for botManager

* Always enable Botmanager

* Fix bot handle

* Fix get positions

* Add Ticker url

* Dont start stopped bot

* fix
This commit is contained in:
Oda
2025-05-09 17:40:31 +02:00
committed by GitHub
parent a8eb0aaf02
commit 7c38c27b4a
54 changed files with 5164 additions and 641 deletions

View File

@@ -108,6 +108,8 @@ public class BacktestController : BaseController
/// <param name="moneyManagementName">The name of the money management strategy to use.</param>
/// <param name="moneyManagement">The money management strategy details, if not using a named strategy.</param>
/// <param name="save">Whether to save the backtest results.</param>
/// <param name="cooldownPeriod">The cooldown period for the backtest.</param>
/// <param name="maxLossStreak">The maximum loss streak for the backtest.</param>
/// <returns>The result of the backtest.</returns>
[HttpPost]
[Route("Run")]
@@ -122,7 +124,9 @@ public class BacktestController : BaseController
DateTime startDate,
DateTime endDate,
MoneyManagement? moneyManagement = null,
bool save = false)
bool save = false,
decimal cooldownPeriod = 1,
int maxLossStreak = 0)
{
if (string.IsNullOrEmpty(accountName))
{
@@ -174,7 +178,9 @@ public class BacktestController : BaseController
endDate,
user,
watchOnly,
save);
save,
cooldownPeriod: cooldownPeriod,
maxLossStreak: maxLossStreak);
break;
case BotType.FlippingBot:
backtestResult = await _backtester.RunFlippingBotBacktest(
@@ -188,7 +194,9 @@ public class BacktestController : BaseController
endDate,
user,
watchOnly,
save);
save,
cooldownPeriod: cooldownPeriod,
maxLossStreak: maxLossStreak);
break;
}