diff --git a/src/Managing.Application/Bots/SpotBot.cs b/src/Managing.Application/Bots/SpotBot.cs index 40d75364..01c8827e 100644 --- a/src/Managing.Application/Bots/SpotBot.cs +++ b/src/Managing.Application/Bots/SpotBot.cs @@ -1149,8 +1149,12 @@ public class SpotBot : TradingBotBase _scopeFactory, async exchangeService => await exchangeService.GetBalance(Account, Config.Ticker)); - // Token balance should be zero or very small (dust) after closing - var maxDustAmount = 0.0001m; // Consider amounts less than this as cleared + // For ETH, remaining balance is expected (gas reserve) - use higher threshold + // For other tokens, very small dust amounts are acceptable + var maxDustAmount = Config.Ticker == Ticker.ETH + ? 0.01m // ETH: up to 0.01 ETH is acceptable (gas reserve) + : 0.0001m; // Other tokens: only dust amounts acceptable + if (tokenBalance is { Amount: > 0 } && tokenBalance.Amount > maxDustAmount) { await LogWarningAsync( @@ -1171,7 +1175,7 @@ public class SpotBot : TradingBotBase $"Position: `{closedPosition.Identifier}`\n" + $"Ticker: {Config.Ticker}\n" + $"Token Balance: `{tokenBalance?.Amount ?? 0:F5}`\n" + - $"Position successfully closed on exchange"); + $"{(Config.Ticker == Ticker.ETH && tokenBalance?.Amount > 0 ? "(Gas reserve - expected)" : "Position successfully closed on exchange")}"); } } catch (Exception ex)