diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 376730d0f..5a3b790c9 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -78,7 +78,7 @@ class Backtesting(object): Generates and returns a text table for the given backtest data and the results dataframe :return: pretty printed table with tabulate as str """ - stake_currency = self.config.get('stake_currency') + stake_currency = str(self.config.get('stake_currency')) floatfmt = ('s', 'd', '.2f', '.8f', '.1f') tabular_data = [] @@ -168,7 +168,7 @@ class Backtesting(object): record = args.get('record', None) records = [] trades = [] - trade_count_lock = {} + trade_count_lock: Dict = {} for pair, pair_data in processed.items(): pair_data['buy'], pair_data['sell'] = 0, 0 # cleanup from previous run @@ -230,7 +230,7 @@ class Backtesting(object): else: logger.info('Using local backtesting data (using whitelist in given config) ...') - timerange = Arguments.parse_timerange(self.config.get('timerange')) + timerange = Arguments.parse_timerange(str(self.config.get('timerange'))) data = optimize.load_data( self.config['datadir'], pairs=pairs, diff --git a/freqtrade/optimize/hyperopt.py b/freqtrade/optimize/hyperopt.py index b4f534d7c..f6cbb270b 100644 --- a/freqtrade/optimize/hyperopt.py +++ b/freqtrade/optimize/hyperopt.py @@ -494,9 +494,10 @@ class Hyperopt(Backtesting): ) def start(self) -> None: - timerange = Arguments.parse_timerange(self.config.get('timerange')) + timerange = Arguments.parse_timerange(self.config.get('timerange') if self.config.get( + 'timerange') is None else str(self.config.get('timerange'))) data = load_data( - datadir=self.config.get('datadir'), + datadir=str(self.config.get('datadir')), pairs=self.config['exchange']['pair_whitelist'], ticker_interval=self.ticker_interval, timerange=timerange diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index df809cc2f..3e39657f2 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -2,7 +2,7 @@ This module contains class to define a RPC communications """ import logging -from datetime import datetime, timedelta +from datetime import datetime, timedelta, date from decimal import Decimal from typing import Dict, Tuple, Any, Optional @@ -114,7 +114,7 @@ class RPC(object): self, timescale: int, stake_currency: str, fiat_display_currency: str) -> Tuple[bool, Any]: today = datetime.utcnow().date() - profit_days: Dict[int, Dict] = {} + profit_days: Dict[date, Dict] = {} if not (isinstance(timescale, int) and timescale > 0): return True, '*Daily [n]:* `must be an integer greater than 0`' @@ -172,7 +172,7 @@ class RPC(object): durations = [] for trade in trades: - current_rate: Optional[float] = None + current_rate: float = 0.0 if not trade.open_rate: continue