Add test case for funding fee update failure

This commit is contained in:
Matthias 2022-09-08 07:13:15 +00:00
parent 39b6cadd14
commit 791f61c089
2 changed files with 10 additions and 2 deletions

View File

@ -292,8 +292,6 @@ class FreqtradeBot(LoggingMixin):
trade.funding_fees = funding_fees
except ExchangeError:
logger.warning("Could not update funding fees for open trades.")
else:
return 0.0
def startup_backpopulate_precision(self):

View File

@ -5430,6 +5430,16 @@ def test_update_funding_fees(
))
def test_update_funding_fees_error(mocker, default_conf, caplog):
mocker.patch('freqtrade.exchange.Exchange.get_funding_fees', side_effect=ExchangeError())
default_conf['trading_mode'] = 'futures'
default_conf['margin_mode'] = 'isolated'
freqtrade = get_patched_freqtradebot(mocker, default_conf)
freqtrade.update_funding_fees()
log_has("Could not update funding fees for open trades.", caplog)
def test_position_adjust(mocker, default_conf_usdt, fee) -> None:
patch_RPCManager(mocker)
patch_exchange(mocker)