Don't unnecessarily reset order_id

This commit is contained in:
Matthias 2022-09-30 15:07:18 +02:00
parent cc06c60fd8
commit bd664580fb

View File

@ -1345,7 +1345,7 @@ class FreqtradeBot(LoggingMixin):
""" """
entry cancel - cancel order entry cancel - cancel order
:param replacing: Replacing order - prevent trade deletion. :param replacing: Replacing order - prevent trade deletion.
:return: True if order was fully cancelled :return: True if trade was fully cancelled
""" """
was_trade_fully_canceled = False was_trade_fully_canceled = False
side = trade.entry_side.capitalize() side = trade.entry_side.capitalize()
@ -1389,14 +1389,12 @@ class FreqtradeBot(LoggingMixin):
reason += f", {constants.CANCEL_REASON['FULLY_CANCELLED']}" reason += f", {constants.CANCEL_REASON['FULLY_CANCELLED']}"
else: else:
self.update_trade_state(trade, trade.open_order_id, corder) self.update_trade_state(trade, trade.open_order_id, corder)
trade.open_order_id = None
logger.info(f'{side} Order timeout for {trade}.') logger.info(f'{side} Order timeout for {trade}.')
else: else:
# update_trade_state (and subsequently recalc_trade_from_orders) will handle updates # update_trade_state (and subsequently recalc_trade_from_orders) will handle updates
# to the trade object # to the trade object
self.update_trade_state(trade, trade.open_order_id, corder) self.update_trade_state(trade, trade.open_order_id, corder)
trade.open_order_id = None
logger.info(f'Partial {trade.entry_side} order timeout for {trade}.') logger.info(f'Partial {trade.entry_side} order timeout for {trade}.')
reason += f", {constants.CANCEL_REASON['PARTIALLY_FILLED']}" reason += f", {constants.CANCEL_REASON['PARTIALLY_FILLED']}"