Reset stoploss_order_id when recreating fails

This commit is contained in:
Matthias 2019-08-24 18:06:14 +02:00
parent 3820a38e79
commit 3f6eeda3f0

View File

@ -662,6 +662,7 @@ class FreqtradeBot(object):
return False return False
except DependencyException as exception: except DependencyException as exception:
trade.stoploss_order_id = None
logger.warning('Unable to place a stoploss order on exchange: %s', exception) logger.warning('Unable to place a stoploss order on exchange: %s', exception)
# If stoploss order is canceled for some reason we add it # If stoploss order is canceled for some reason we add it
@ -674,6 +675,7 @@ class FreqtradeBot(object):
trade.stoploss_order_id = str(stoploss_order_id) trade.stoploss_order_id = str(stoploss_order_id)
return False return False
except DependencyException as exception: except DependencyException as exception:
trade.stoploss_order_id = None
logger.warning('Stoploss order was cancelled, ' logger.warning('Stoploss order was cancelled, '
'but unable to recreate one: %s', exception) 'but unable to recreate one: %s', exception)
@ -726,7 +728,8 @@ class FreqtradeBot(object):
)['id'] )['id']
trade.stoploss_order_id = str(stoploss_order_id) trade.stoploss_order_id = str(stoploss_order_id)
except DependencyException: except DependencyException:
logger.exception(f"Could create trailing stoploss order " trade.stoploss_order_id = None
logger.exception(f"Could not create trailing stoploss order "
f"for pair {trade.pair}.") f"for pair {trade.pair}.")
def _check_and_execute_sell(self, trade: Trade, sell_rate: float, def _check_and_execute_sell(self, trade: Trade, sell_rate: float,