fix mypy/flake8

This commit is contained in:
robcaulk 2022-09-17 17:51:06 +02:00
parent d056d766ed
commit 7b1d409c98
2 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,7 @@ from freqtrade.freqai.freqai_interface import IFreqaiModel
from freqtrade.freqai.RL.Base5ActionRLEnv import Actions, Base5ActionRLEnv from freqtrade.freqai.RL.Base5ActionRLEnv import Actions, Base5ActionRLEnv
from freqtrade.freqai.RL.BaseEnvironment import BaseEnvironment, Positions from freqtrade.freqai.RL.BaseEnvironment import BaseEnvironment, Positions
from freqtrade.persistence import Trade from freqtrade.persistence import Trade
import pytest
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -157,10 +157,10 @@ class BaseReinforcementLearningModel(IFreqaiModel):
if trade.pair == pair: if trade.pair == pair:
# FIXME: get_rate and trade_udration shouldn't work with backtesting, # FIXME: get_rate and trade_udration shouldn't work with backtesting,
# we need to use candle dates and prices to compute that. # we need to use candle dates and prices to compute that.
if self.strategy.dp._exchange is None: if self.strategy.dp._exchange is None: # type: ignore
logger.error('No exchange available.') logger.error('No exchange available.')
else: else:
current_value = self.strategy.dp._exchange.get_rate( current_value = self.strategy.dp._exchange.get_rate( # type: ignore
pair, refresh=False, side="exit", is_short=trade.is_short) pair, refresh=False, side="exit", is_short=trade.is_short)
openrate = trade.open_rate openrate = trade.open_rate
now = datetime.now(timezone.utc).timestamp() now = datetime.now(timezone.utc).timestamp()

View File

@ -92,7 +92,7 @@ class IFreqaiModel(ABC):
self._threads: List[threading.Thread] = [] self._threads: List[threading.Thread] = []
self._stop_event = threading.Event() self._stop_event = threading.Event()
self.strategy: IStrategy = None self.strategy: Optional[IStrategy] = None
def __getstate__(self): def __getstate__(self):
""" """