From 5e6cda11efdc1d03a09a3db30ba42dab646c8270 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 25 Nov 2022 14:43:43 +0100 Subject: [PATCH] Update method name for trade fee updating --- freqtrade/freqtradebot.py | 4 ++-- tests/test_freqtradebot.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 77b099d80..6ffc6a755 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -191,7 +191,7 @@ class FreqtradeBot(LoggingMixin): # Check whether markets have to be reloaded and reload them when it's needed self.exchange.reload_markets() - self.update_closed_trades_without_assigned_fees() + self.update_trades_without_assigned_fees() # Query trades from persistence layer trades = Trade.get_open_trades() @@ -354,7 +354,7 @@ class FreqtradeBot(LoggingMixin): if self.trading_mode == TradingMode.FUTURES: self._schedule.run_pending() - def update_closed_trades_without_assigned_fees(self) -> None: + def update_trades_without_assigned_fees(self) -> None: """ Update closed trades without close fees assigned. Only acts when Orders are in the database, otherwise the last order-id is unknown. diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index 6b47dc1d1..83b7e9b27 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -5046,7 +5046,7 @@ def test_startup_backpopulate_precision(mocker, default_conf_usdt, fee, caplog): @pytest.mark.usefixtures("init_persistence") @pytest.mark.parametrize("is_short", [False, True]) -def test_update_closed_trades_without_assigned_fees(mocker, default_conf_usdt, fee, is_short): +def test_update_trades_without_assigned_fees(mocker, default_conf_usdt, fee, is_short): freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt) def patch_with_fee(order): @@ -5075,7 +5075,7 @@ def test_update_closed_trades_without_assigned_fees(mocker, default_conf_usdt, f assert trade.fee_close_cost is None assert trade.fee_close_currency is None - freqtrade.update_closed_trades_without_assigned_fees() + freqtrade.update_trades_without_assigned_fees() # Does nothing for dry-run trades = Trade.get_trades().all() @@ -5088,7 +5088,7 @@ def test_update_closed_trades_without_assigned_fees(mocker, default_conf_usdt, f freqtrade.config['dry_run'] = False - freqtrade.update_closed_trades_without_assigned_fees() + freqtrade.update_trades_without_assigned_fees() trades = Trade.get_trades().all() assert len(trades) == MOCK_TRADE_COUNT @@ -5551,7 +5551,7 @@ def test_position_adjust(mocker, default_conf_usdt, fee) -> None: assert trade.stake_amount == 110 # Assume it does nothing since order is closed and trade is open - freqtrade.update_closed_trades_without_assigned_fees() + freqtrade.update_trades_without_assigned_fees() trade = Trade.query.first() assert trade @@ -5622,7 +5622,7 @@ def test_position_adjust(mocker, default_conf_usdt, fee) -> None: mocker.patch('freqtrade.exchange.Exchange.create_order', fetch_order_mm) mocker.patch('freqtrade.exchange.Exchange.fetch_order', fetch_order_mm) mocker.patch('freqtrade.exchange.Exchange.fetch_order_or_stoploss_order', fetch_order_mm) - freqtrade.update_closed_trades_without_assigned_fees() + freqtrade.update_trades_without_assigned_fees() orders = Order.query.all() assert orders @@ -5839,7 +5839,7 @@ def test_position_adjust2(mocker, default_conf_usdt, fee) -> None: assert trade.stake_amount == bid * amount # Assume it does nothing since order is closed and trade is open - freqtrade.update_closed_trades_without_assigned_fees() + freqtrade.update_trades_without_assigned_fees() trade = Trade.query.first() assert trade