Making changes so the build checks are satisified (imports & flake8)

Signed-off-by: hoeckxer <hawkeyenl@yahoo.com>
This commit is contained in:
hoeckxer 2021-01-05 07:06:53 +01:00
parent 614a996597
commit 844df96ec7
2 changed files with 8 additions and 4 deletions

View File

@ -5,7 +5,7 @@ This module defines the interface to apply for strategies
import logging import logging
import warnings import warnings
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from datetime import datetime, timezone, timedelta from datetime import datetime, timedelta, timezone
from enum import Enum from enum import Enum
from typing import Dict, List, NamedTuple, Optional, Tuple from typing import Dict, List, NamedTuple, Optional, Tuple
@ -487,11 +487,15 @@ class IStrategy(ABC):
def ignore_expired_candle(self, dataframe: DataFrame, buy: bool): def ignore_expired_candle(self, dataframe: DataFrame, buy: bool):
if self.ignore_buying_expired_candle and buy: 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] candle_time = dataframe['date'].tail(1).iat[0]
time_delta = current_time - candle_time time_delta = current_time - candle_time
if time_delta.total_seconds() > self.ignore_buying_expired_candle_after: 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 return True
else: else:
return False return False

View File

@ -120,7 +120,7 @@ def test_ignore_expired_candle(default_conf, ohlcv_history):
mocked_history.loc[1, 'buy'] = 1 mocked_history.loc[1, 'buy'] = 1
mocked_history.loc[1, 'sell'] = 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): def test_assert_df_raise(mocker, caplog, ohlcv_history):