remove irrelevant trade.has_open_orders conditions

This commit is contained in:
Axel-CH 2024-09-11 18:42:51 -04:00
parent 730bef2920
commit 33b421014d
2 changed files with 4 additions and 6 deletions

View File

@ -1246,8 +1246,7 @@ class FreqtradeBot(LoggingMixin):
trades_closed = 0 trades_closed = 0
for trade in trades: for trade in trades:
if ( if (
not trade.has_open_orders not trade.has_open_sl_orders
and not trade.has_open_sl_orders
and not self.wallets.check_exit_amount(trade) and not self.wallets.check_exit_amount(trade)
): ):
logger.warning( logger.warning(
@ -1272,7 +1271,7 @@ class FreqtradeBot(LoggingMixin):
f"Unable to handle stoploss on exchange for {trade.pair}: {exception}" f"Unable to handle stoploss on exchange for {trade.pair}: {exception}"
) )
# Check if we can sell our current pair # Check if we can sell our current pair
if trade.has_untied_assets and trade.is_open and self.handle_trade(trade): if trade.is_open and self.handle_trade(trade):
trades_closed += 1 trades_closed += 1
except DependencyException as exception: except DependencyException as exception:
@ -1416,7 +1415,7 @@ class FreqtradeBot(LoggingMixin):
self.handle_protections(trade.pair, trade.trade_direction) self.handle_protections(trade.pair, trade.trade_direction)
return True return True
if trade.has_open_orders or not trade.is_open: if not trade.is_open:
# Trade has an open order, Stoploss-handling can't happen in this case # Trade has an open order, Stoploss-handling can't happen in this case
# as the Amount on the exchange is tied up in another trade. # as the Amount on the exchange is tied up in another trade.
# The trade can be closed already (sell-order fill confirmation came in this iteration) # The trade can be closed already (sell-order fill confirmation came in this iteration)

View File

@ -1377,8 +1377,7 @@ class Backtesting:
self.wallets.update() self.wallets.update()
# 4. Create exit orders (if any) # 4. Create exit orders (if any)
if trade.has_open_position: self._check_trade_exit(trade, row, current_time) # Place exit order if necessary
self._check_trade_exit(trade, row, current_time) # Place exit order if necessary
# 5. Process exit orders. # 5. Process exit orders.
order = trade.select_order(trade.exit_side, is_open=True) order = trade.select_order(trade.exit_side, is_open=True)