Add automatic swap when low ETH
This commit is contained in:
@@ -141,18 +141,6 @@ public class TradingBotBase : ITradingBot
|
||||
{
|
||||
if (!Config.IsForBacktest)
|
||||
{
|
||||
// Check broker balance before running
|
||||
await ServiceScopeHelpers.WithScopedService<IExchangeService>(_scopeFactory, async exchangeService =>
|
||||
{
|
||||
var balance = await exchangeService.GetBalance(Account, false);
|
||||
if (balance < Constants.GMX.Config.MinimumPositionAmount && Positions.All(p => p.Value.IsFinished()))
|
||||
{
|
||||
await LogWarning(
|
||||
$"Balance on broker is below {Constants.GMX.Config.MinimumPositionAmount} USD (actual: {balance}). Stopping bot {Identifier}.");
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
await LoadLastCandle();
|
||||
}
|
||||
|
||||
@@ -1380,7 +1368,7 @@ public class TradingBotBase : ITradingBot
|
||||
$"🔄 **Watch Mode Toggle**\nBot: `{Config.Name}`\nWatch Only: `{(Config.IsForWatchingOnly ? "ON" : "OFF")}`");
|
||||
}
|
||||
|
||||
private async Task LogInformation(string message)
|
||||
public async Task LogInformation(string message)
|
||||
{
|
||||
Logger.LogInformation(message);
|
||||
|
||||
@@ -1397,7 +1385,7 @@ public class TradingBotBase : ITradingBot
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LogWarning(string message)
|
||||
public async Task LogWarning(string message)
|
||||
{
|
||||
message = $"[{Config.Name}] {message}";
|
||||
SentrySdk.CaptureException(new Exception(message));
|
||||
|
||||
Reference in New Issue
Block a user