simplify has_open_position property, restore process_open_trades_positions comment

This commit is contained in:
Axel-CH 2024-09-24 12:17:11 -04:00
parent 5ba592ff47
commit beebc1743a
2 changed files with 3 additions and 7 deletions

View File

@ -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)

View File

@ -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]: