From ffaa121bc7f94e44acb3595ea37fdaf64c152b35 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 7 Sep 2023 20:16:56 +0200 Subject: [PATCH] Simplify code by removing unnecessary (and non-working) method --- freqtrade/freqtradebot.py | 4 ++-- freqtrade/persistence/trade_model.py | 8 -------- tests/persistence/test_persistence.py | 1 - 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 6e679d64d..b9dfb6772 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -1315,7 +1315,7 @@ class FreqtradeBot(LoggingMixin): Timeout setting takes priority over limit order adjustment request. :return: None """ - for trade in Trade.get_open_order_trades(): + for trade in Trade.get_open_trades(): for open_order in trade.open_orders: try: order = self.exchange.fetch_order(open_order.order_id, trade.pair) @@ -1426,7 +1426,7 @@ class FreqtradeBot(LoggingMixin): :return: None """ - for trade in Trade.get_open_order_trades(): + for trade in Trade.get_open_trades(): for open_order in trade.open_orders: try: order = self.exchange.fetch_order(open_order.order_id, trade.pair) diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index 3212297e1..aeba99a5e 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -1442,14 +1442,6 @@ class Trade(ModelBase, LocalTrade): # raise an exception. return Trade.session.scalars(query) - @staticmethod - def get_open_order_trades() -> List['Trade']: - """ - Returns all open trades - NOTE: Not supported in Backtesting. - """ - return cast(List[Trade], Trade.get_trades([Trade.open_orders_count != 0]).all()) - @staticmethod def get_open_trades_without_assigned_fees(): """ diff --git a/tests/persistence/test_persistence.py b/tests/persistence/test_persistence.py index dd4993f78..6e1b75045 100644 --- a/tests/persistence/test_persistence.py +++ b/tests/persistence/test_persistence.py @@ -2037,7 +2037,6 @@ def test_Trade_object_idem(): 'total_open_trades_stakes', 'get_closed_trades_without_assigned_fees', 'get_open_trades_without_assigned_fees', - 'get_open_order_trades', 'get_trades', 'get_trades_query', 'get_exit_reason_performance',