Typecheck improvements
This commit is contained in:
parent
e28973c50a
commit
4a322abd4d
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user