From 3f6eeda3f0e76627e9b62b672d59e7be46ef64f5 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 24 Aug 2019 18:06:14 +0200 Subject: [PATCH] Reset stoploss_order_id when recreating fails --- freqtrade/freqtradebot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index e5ecef8bf..e88b9db6a 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -662,6 +662,7 @@ class FreqtradeBot(object): return False except DependencyException as exception: + trade.stoploss_order_id = None logger.warning('Unable to place a stoploss order on exchange: %s', exception) # 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) return False except DependencyException as exception: + trade.stoploss_order_id = None logger.warning('Stoploss order was cancelled, ' 'but unable to recreate one: %s', exception) @@ -726,7 +728,8 @@ class FreqtradeBot(object): )['id'] trade.stoploss_order_id = str(stoploss_order_id) 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}.") def _check_and_execute_sell(self, trade: Trade, sell_rate: float,