diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 62ef4e91b..5f7ef8590 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -5,7 +5,7 @@ This module defines the interface to apply for strategies import logging import warnings from abc import ABC, abstractmethod -from datetime import datetime, timezone, timedelta +from datetime import datetime, timedelta, timezone from enum import Enum from typing import Dict, List, NamedTuple, Optional, Tuple @@ -487,11 +487,15 @@ class IStrategy(ABC): def ignore_expired_candle(self, dataframe: DataFrame, buy: bool): if self.ignore_buying_expired_candle and buy: - current_time = datetime.now(timezone.utc) - timedelta(seconds=self.ignore_buying_expired_candle_after) + current_time = datetime.now(timezone.utc) - timedelta( + seconds=self.ignore_buying_expired_candle_after) candle_time = dataframe['date'].tail(1).iat[0] time_delta = current_time - candle_time if time_delta.total_seconds() > self.ignore_buying_expired_candle_after: - logger.debug('ignoring buy signals because candle exceeded ignore_buying_expired_candle_after of %s seconds', self.ignore_buying_expired_candle_after) + logger.debug( + '''ignoring buy signals because candle exceeded + ignore_buying_expired_candle_after of %s seconds''', + self.ignore_buying_expired_candle_after) return True else: return False diff --git a/tests/strategy/test_interface.py b/tests/strategy/test_interface.py index 330689039..f389be45b 100644 --- a/tests/strategy/test_interface.py +++ b/tests/strategy/test_interface.py @@ -120,7 +120,7 @@ def test_ignore_expired_candle(default_conf, ohlcv_history): mocked_history.loc[1, 'buy'] = 1 mocked_history.loc[1, 'sell'] = 1 - assert strategy.ignore_expired_candle(mocked_history, True) == True + assert strategy.ignore_expired_candle(mocked_history, True) is True def test_assert_df_raise(mocker, caplog, ohlcv_history):