From beebc1743a5248eb0d148821c0382a430c53bd13 Mon Sep 17 00:00:00 2001 From: Axel-CH Date: Tue, 24 Sep 2024 12:17:11 -0400 Subject: [PATCH] simplify has_open_position property, restore process_open_trades_positions comment --- freqtrade/freqtradebot.py | 2 ++ freqtrade/persistence/trade_model.py | 8 +------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 511788272..d7f895f56 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -715,6 +715,8 @@ class FreqtradeBot(LoggingMixin): """ # Walk through each pair and check if it needs changes for trade in Trade.get_open_trades(): + # If there is any open orders, wait for them to finish. + # TODO Remove to allow mul open orders if not trade.has_open_orders: # Do a wallets update (will be ratelimited to once per hour) self.wallets.update(False) diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index aef34d95e..8d54458d4 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -591,13 +591,7 @@ class LocalTrade: """ True if there is an open position for this trade """ - entry_orders = [o for o in self.orders if o.ft_order_side == self.entry_side] - entry_orders_filled_qty = sum(eno.safe_filled for eno in entry_orders) - - exit_orders = [o for o in self.orders if o.ft_order_side == self.exit_side] - exit_orders_filled_qty = sum(exo.safe_filled for exo in exit_orders) - - return (entry_orders_filled_qty - exit_orders_filled_qty) > 0 + return self.amount > 0 @property def open_sl_orders(self) -> List[Order]: