Replace calls to load_data
This commit is contained in:
parent
f261911285
commit
21aba1620c
@ -74,7 +74,7 @@ def load_tickerdata_file(
|
||||
path = make_testdata_path(datadir)
|
||||
pair_s = pair.replace('/', '_')
|
||||
file = path.joinpath(f'{pair_s}-{ticker_interval}.json')
|
||||
gzipfile = file.with_suffix('.gz')
|
||||
gzipfile = file.with_suffix(file.suffix + '.gz')
|
||||
|
||||
# If the file does not exist we download it when None is returned.
|
||||
# If file exists, read the file, load the json
|
||||
@ -94,7 +94,7 @@ def load_tickerdata_file(
|
||||
return pairdata
|
||||
|
||||
|
||||
def load_data(datadir: Path,
|
||||
def load_data(datadir: Optional[Path],
|
||||
ticker_interval: str,
|
||||
pairs: List[str],
|
||||
refresh_pairs: Optional[bool] = False,
|
||||
|
@ -1,9 +1,10 @@
|
||||
# pragma pylint: disable=W0603
|
||||
""" Edge positioning package """
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, NamedTuple
|
||||
import arrow
|
||||
|
||||
import arrow
|
||||
import numpy as np
|
||||
import utils_find_1st as utf1st
|
||||
from pandas import DataFrame
|
||||
@ -99,7 +100,7 @@ class Edge():
|
||||
logger.info('Using local backtesting data (using whitelist in given config) ...')
|
||||
|
||||
data = history.load_data(
|
||||
self.config['datadir'],
|
||||
Path(self.config.get('datadir')) if self.config.get('datadir') else None,
|
||||
pairs=pairs,
|
||||
ticker_interval=self.ticker_interval,
|
||||
refresh_pairs=self._refresh_pairs,
|
||||
|
@ -370,7 +370,7 @@ class Backtesting(object):
|
||||
timerange = Arguments.parse_timerange(None if self.config.get(
|
||||
'timerange') is None else str(self.config.get('timerange')))
|
||||
data = history.load_data(
|
||||
self.config['datadir'],
|
||||
Path(self.config.get('datadir')) if self.config.get('datadir') else None,
|
||||
pairs=pairs,
|
||||
ticker_interval=self.ticker_interval,
|
||||
refresh_pairs=self.config.get('refresh_pairs', False),
|
||||
|
@ -5,11 +5,12 @@ This module contains the hyperopt logic
|
||||
"""
|
||||
|
||||
import logging
|
||||
import multiprocessing
|
||||
from argparse import Namespace
|
||||
import os
|
||||
import sys
|
||||
from argparse import Namespace
|
||||
from pathlib import Path
|
||||
from math import exp
|
||||
import multiprocessing
|
||||
from operator import itemgetter
|
||||
from typing import Any, Dict, List
|
||||
|
||||
@ -240,7 +241,7 @@ class Hyperopt(Backtesting):
|
||||
timerange = Arguments.parse_timerange(None if self.config.get(
|
||||
'timerange') is None else str(self.config.get('timerange')))
|
||||
data = load_data(
|
||||
datadir=str(self.config.get('datadir')),
|
||||
datadir=Path(self.config.get('datadir')) if self.config.get('datadir') else None,
|
||||
pairs=self.config['exchange']['pair_whitelist'],
|
||||
ticker_interval=self.ticker_interval,
|
||||
timerange=timerange
|
||||
|
@ -82,7 +82,7 @@ for pair in PAIRS:
|
||||
dl_file.unlink()
|
||||
|
||||
print(f'downloading pair {pair}, interval {tick_interval}')
|
||||
download_backtesting_testdata(str(dl_path), exchange=exchange,
|
||||
download_backtesting_testdata(dl_path, exchange=exchange,
|
||||
pair=pair,
|
||||
tick_interval=tick_interval,
|
||||
timerange=timerange)
|
||||
|
Loading…
Reference in New Issue
Block a user