From 3d2249717750d09c3fbe308e3ddd743771d8a59d Mon Sep 17 00:00:00 2001 From: Sam Germain Date: Wed, 5 Jan 2022 00:46:09 -0600 Subject: [PATCH 1/2] add warning for futures dust to freqtradebot.apply_fee_conditional --- freqtrade/freqtradebot.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index e714ddc33..0b9c14577 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -1540,9 +1540,16 @@ class FreqtradeBot(LoggingMixin): Can eat into dust if more than the required asset is available. """ self.wallets.update() - if fee_abs != 0 and self.wallets.get_free(trade_base_currency) >= amount: + free_base = self.wallets.get_free(trade_base_currency) + if fee_abs != 0 and free_base >= amount: + if self.trading_mode == TradingMode.FUTURES: + logger.warning( + f'freqtradebot.wallets.get_free({trade_base_currency}) >= amount' + ' {free_base} >= {amount}' + 'while trading_mode == FUTURES. This should not happen because there' + 'is no dust in futures trading and indicates a problem' + ) # Eat into dust if we own more than base currency - # TODO-lev: settle currency for futures logger.info(f"Fee amount for {trade} was in base currency - " f"Eating Fee {fee_abs} into dust.") elif fee_abs != 0: From 6ad521a0f79363705a82c3780e1fdf4ef8d5e8b6 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 6 Jan 2022 09:55:11 +0100 Subject: [PATCH 2/2] Update apply_fee_conditional with note about futures --- freqtrade/freqtradebot.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 0b9c14577..48e17b559 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -1538,17 +1538,11 @@ class FreqtradeBot(LoggingMixin): """ Applies the fee to amount (either from Order or from Trades). Can eat into dust if more than the required asset is available. + Can't happen in Futures mode - where Fees are always in settlement currency, + never in base currency. """ self.wallets.update() - free_base = self.wallets.get_free(trade_base_currency) - if fee_abs != 0 and free_base >= amount: - if self.trading_mode == TradingMode.FUTURES: - logger.warning( - f'freqtradebot.wallets.get_free({trade_base_currency}) >= amount' - ' {free_base} >= {amount}' - 'while trading_mode == FUTURES. This should not happen because there' - 'is no dust in futures trading and indicates a problem' - ) + if fee_abs != 0 and self.wallets.get_free(trade_base_currency) >= amount: # Eat into dust if we own more than base currency logger.info(f"Fee amount for {trade} was in base currency - " f"Eating Fee {fee_abs} into dust.")