From 144e053a4e1349d9037317c3a697e77983484926 Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Thu, 20 Jun 2019 03:26:25 +0300 Subject: [PATCH] fix for #1948 --- freqtrade/strategy/interface.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 68e0a7b37..353ae64b4 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -357,13 +357,13 @@ class IStrategy(ABC): # Check if time matches and current rate is above threshold trade_dur = (current_time.timestamp() - trade.open_date.timestamp()) / 60 - # Get highest entry in ROI dict where key >= trade-duration - roi_entry = max(list(filter(lambda x: trade_dur >= x, self.minimal_roi.keys()))) + # Get highest entry in ROI dict where key <= trade-duration + roi_list = list(filter(lambda x: x <= trade_dur, self.minimal_roi.keys())) + if not roi_list: + return False + roi_entry = max(roi_list) threshold = self.minimal_roi[roi_entry] - if current_profit > threshold: - return True - - return False + return current_profit > threshold def tickerdata_to_dataframe(self, tickerdata: Dict[str, List]) -> Dict[str, DataFrame]: """