From bf46f2e50d0025241bfa6d221fb8752b0ea60ef0 Mon Sep 17 00:00:00 2001 From: Janne Sinivirta Date: Tue, 6 Feb 2018 21:16:44 +0200 Subject: [PATCH] short circuit check for roi threshold --- freqtrade/main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/freqtrade/main.py b/freqtrade/main.py index 05ea077c3..48dfb3818 100755 --- a/freqtrade/main.py +++ b/freqtrade/main.py @@ -302,10 +302,12 @@ def min_roi_reached(trade: Trade, current_rate: float, current_time: datetime) - # Check if time matches and current rate is above threshold time_diff = (current_time.timestamp() - trade.open_date.timestamp()) / 60 - for duration, threshold in strategy.minimal_roi.items(): - if time_diff > float(duration) and current_profit > threshold: + for duration_string, threshold in strategy.minimal_roi.items(): + duration = float(duration_string) + if time_diff > duration and current_profit > threshold: return True - + if time_diff < duration: + return False return False