Fix bot launch errors
This commit is contained in:
@@ -99,7 +99,15 @@ public class TradingBot : Bot, ITradingBot
|
||||
LoadScenario();
|
||||
await PreloadCandles();
|
||||
await CancelAllOrders();
|
||||
await MessengerService.SendMessage($"Hi everyone, I'm going to run {Name}. \nI will send a message here everytime a signal is triggered by the {string.Join(",", Strategies.Select(s => s.Name))} strategies.");
|
||||
|
||||
try
|
||||
{
|
||||
await MessengerService.SendMessage($"Hi everyone, I'm going to run {Name}. \nI will send a message here everytime a signal is triggered by the {string.Join(",", Strategies.Select(s => s.Name))} strategies.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, ex.Message);
|
||||
}
|
||||
await InitWorker(Run);
|
||||
}
|
||||
|
||||
@@ -553,7 +561,7 @@ public class TradingBot : Bot, ITradingBot
|
||||
|
||||
private async Task CancelAllOrders()
|
||||
{
|
||||
if (!IsForBacktest)
|
||||
if (!IsForBacktest && !IsForWatchingOnly)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -2,21 +2,16 @@
|
||||
using MediatR;
|
||||
using static Managing.Common.Enums;
|
||||
using Managing.Application.Abstractions;
|
||||
using Managing.Application.ManageBot.Commands;
|
||||
using Managing.Domain.MoneyManagements;
|
||||
|
||||
namespace Managing.Application.ManageBot
|
||||
{
|
||||
public class BackupBotCommandHandler : IRequestHandler<BackupBotCommand, bool>
|
||||
{
|
||||
private readonly IBotFactory _botFactory;
|
||||
private readonly ITaskCache _taskCache;
|
||||
private readonly IMoneyManagementService _moneyManagementService;
|
||||
private readonly IBotService _botService;
|
||||
|
||||
public BackupBotCommandHandler(IBotFactory botFactory, ITaskCache taskCache, IBotService botService)
|
||||
public BackupBotCommandHandler(ITaskCache taskCache, IBotService botService)
|
||||
{
|
||||
_botFactory = botFactory;
|
||||
_taskCache = taskCache;
|
||||
_botService = botService;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Managing.Application.Abstractions;
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
|
||||
namespace Managing.Application.ManageBot
|
||||
{
|
||||
|
||||
@@ -206,7 +206,7 @@ public class TradingService : ITradingService
|
||||
|
||||
return _cacheService.GetOrSave($"Fee-{account.Exchange}", () =>
|
||||
{
|
||||
return _tradingRepository.GetFee(TradingExchanges.Evm).Cost;
|
||||
return _tradingRepository.GetFee(TradingExchanges.Evm)?.Cost ?? 0m;
|
||||
}, TimeSpan.FromHours(2));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user