From d1bf388b0edfdf2cab6d9800cdddf50c9b771654 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 15 Jan 2020 19:56:14 +0100 Subject: [PATCH 1/3] Wallet amount must be compared with >= --- freqtrade/freqtradebot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index e3f2616a2..a5d980504 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -904,7 +904,7 @@ class FreqtradeBot: """ wallet_amount = self.wallets.get_free(pair.split('/')[0]) logger.debug(f"{pair} - Wallet: {wallet_amount} - Trade-amount: {amount}") - if wallet_amount > amount: + if wallet_amount >= amount: return amount elif wallet_amount > amount * 0.98: logger.info(f"{pair} - Falling back to wallet-amount.") From 90ed4c665bf21f3388f7bd90a16f5f02d5062621 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 15 Jan 2020 19:59:08 +0100 Subject: [PATCH 2/3] Cover equal case via test --- tests/test_freqtradebot.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index 58f88198a..eedf79553 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -2764,6 +2764,9 @@ def test__safe_sell_amount(default_conf, fee, caplog, mocker): assert freqtrade._safe_sell_amount(trade.pair, trade.amount) == amount_wallet assert log_has_re(r'.*Falling back to wallet-amount.', caplog) + caplog.clear() + assert freqtrade._safe_sell_amount(trade.pair, amount_wallet) == amount_wallet + assert not log_has_re(r'.*Falling back to wallet-amount.', caplog) def test__safe_sell_amount_error(default_conf, fee, caplog, mocker): From 8bcfe4a6aaa370a1dc2f0554c4309d1a713ce152 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 15 Jan 2020 21:01:36 +0100 Subject: [PATCH 3/3] Up log level of safe_sell_amount message --- freqtrade/freqtradebot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index a5d980504..4db5f08b1 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -903,7 +903,7 @@ class FreqtradeBot: :raise: DependencyException: if available balance is not within 2% of the available amount. """ wallet_amount = self.wallets.get_free(pair.split('/')[0]) - logger.debug(f"{pair} - Wallet: {wallet_amount} - Trade-amount: {amount}") + logger.info(f"Selling {pair} - Wallet: {wallet_amount} - Trade-amount: {amount}") if wallet_amount >= amount: return amount elif wallet_amount > amount * 0.98: