Fix unhandled exception

closes #9270
This commit is contained in:
Matthias
2023-10-06 20:13:37 +02:00
parent 1ef5adbb0e
commit 910e317a45
+7
View File
@@ -749,6 +749,7 @@ class FreqtradeBot(LoggingMixin):
:param pair: pair for which we want to create a LIMIT_BUY :param pair: pair for which we want to create a LIMIT_BUY
:param stake_amount: amount of stake-currency for the pair :param stake_amount: amount of stake-currency for the pair
:return: True if a buy order is created, false if it fails. :return: True if a buy order is created, false if it fails.
:raise: DependencyException or it's subclasses like ExchangeError.
""" """
time_in_force = self.strategy.order_time_in_force['entry'] time_in_force = self.strategy.order_time_in_force['entry']
@@ -1452,6 +1453,7 @@ class FreqtradeBot(LoggingMixin):
return return
if adjusted_entry_price: if adjusted_entry_price:
# place new order only if new price is supplied # place new order only if new price is supplied
try:
if not self.execute_entry( if not self.execute_entry(
pair=trade.pair, pair=trade.pair,
stake_amount=( stake_amount=(
@@ -1461,6 +1463,11 @@ class FreqtradeBot(LoggingMixin):
is_short=trade.is_short, is_short=trade.is_short,
mode='replace', mode='replace',
): ):
self.replace_order_failed(
trade, f"Could not replace order for {trade}.")
except DependencyException as exception:
logger.warning(
f'Unable to replace order for {trade.pair}: {exception}')
self.replace_order_failed(trade, f"Could not replace order for {trade}.") self.replace_order_failed(trade, f"Could not replace order for {trade}.")
def cancel_all_open_orders(self) -> None: def cancel_all_open_orders(self) -> None: