Fix loading backup

This commit is contained in:
2025-05-10 00:50:29 +07:00
parent 7c38c27b4a
commit ba2fbc976a
5 changed files with 42 additions and 21 deletions

View File

@@ -52,7 +52,7 @@ public class TradingBot : Bot, ITradingBot
IBotService botService,
TradingBotConfig config
)
: base(config.AccountName)
: base(config.Name)
{
ExchangeService = exchangeService;
AccountService = accountService;
@@ -85,17 +85,17 @@ public class TradingBot : Bot, ITradingBot
}
}
public override async void Start()
public override void Start()
{
base.Start();
// Load account synchronously
await LoadAccount();
LoadAccount().GetAwaiter().GetResult();
if (!Config.IsForBacktest)
{
LoadScenario(Config.ScenarioName);
await PreloadCandles();
await CancelAllOrders();
PreloadCandles().GetAwaiter().GetResult();
CancelAllOrders().GetAwaiter().GetResult();
try
{
@@ -109,7 +109,7 @@ public class TradingBot : Bot, ITradingBot
Logger.LogError(ex, ex.Message);
}
await InitWorker(Run);
InitWorker(Run).GetAwaiter().GetResult();
}
// Fee = TradingService.GetFee(Account, IsForBacktest);
@@ -1010,6 +1010,7 @@ public class TradingBot : Bot, ITradingBot
BotTradingBalance = data.BotTradingBalance,
BotType = data.BotType,
CooldownPeriod = data.CooldownPeriod,
Name = data.Name
};
Signals = data.Signals;