From a8b1dcf3c8b5d8fde4e0ea7c7f0ea22d1b189092 Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Tue, 19 May 2020 22:20:53 +0300 Subject: [PATCH] Minor: cleanup in get_signal() --- freqtrade/strategy/interface.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 8031c7932..ad11fe33a 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -310,7 +310,6 @@ class IStrategy(ABC): logger.warning('Empty candle (OHLCV) data for pair %s', pair) return False, False - latest_date = dataframe['date'].max() try: df_len, df_close, df_date = self.preserve_df(dataframe) dataframe = strategy_safe_wrapper( @@ -326,17 +325,17 @@ class IStrategy(ABC): logger.warning('Empty dataframe for pair %s', pair) return False, False + latest_date = dataframe['date'].max() latest = dataframe.loc[dataframe['date'] == latest_date].iloc[-1] # Check if dataframe is out of date - signal_date = arrow.get(latest['date']) interval_minutes = timeframe_to_minutes(interval) offset = self.config.get('exchange', {}).get('outdated_offset', 5) - if signal_date < (arrow.utcnow().shift(minutes=-(interval_minutes * 2 + offset))): + if latest_date < (arrow.utcnow().shift(minutes=-(interval_minutes * 2 + offset))): logger.warning( 'Outdated history for pair %s. Last tick is %s minutes old', pair, - (arrow.utcnow() - signal_date).seconds // 60 + (arrow.utcnow() - latest_date).seconds // 60 ) return False, False