From c649f9844e8bbff07b01a831fc80927a368523e0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 18 Oct 2019 19:36:04 +0200 Subject: [PATCH] Compare >= instead of = --- freqtrade/freqtradebot.py | 2 +- tests/test_freqtradebot.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index d62c6a912..e2d4454ef 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -705,7 +705,7 @@ class FreqtradeBot: if trade.stop_loss > float(order['info']['stopPrice']): # we check if the update is neccesary update_beat = self.strategy.order_types.get('stoploss_on_exchange_interval', 60) - if (datetime.utcnow() - trade.stoploss_last_update).total_seconds() > update_beat: + if (datetime.utcnow() - trade.stoploss_last_update).total_seconds() >= update_beat: # cancelling the current stoploss on exchange first logger.info('Trailing stoploss: cancelling current stoploss on exchange (id:{%s})' 'in order to add another one ...', order['id']) diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index d4a1d990a..b2268acc5 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -1449,8 +1449,8 @@ def test_tsl_on_exchange_compatible_with_edge(mocker, edge_conf, fee, caplog, # setting stoploss freqtrade.strategy.stoploss = -0.02 - # setting stoploss_on_exchange_interval to -1 second since this test runs fast - freqtrade.strategy.order_types['stoploss_on_exchange_interval'] = -1 + # setting stoploss_on_exchange_interval to 0 seconds + freqtrade.strategy.order_types['stoploss_on_exchange_interval'] = 0 patch_get_signal(freqtrade)