remove download_pairs

This commit is contained in:
Matthias 2018-12-16 10:29:53 +01:00
parent 8826a1df5f
commit 8bd4d03e13

View File

@ -164,24 +164,6 @@ def make_testdata_path(datadir: Optional[Path]) -> Path:
return datadir or (Path(__file__).parent.parent / "tests" / "testdata").resolve() return datadir or (Path(__file__).parent.parent / "tests" / "testdata").resolve()
def download_pairs(datadir, exchange: Exchange, pairs: List[str],
ticker_interval: str,
timerange: TimeRange = TimeRange(None, None, 0, 0)) -> bool:
"""For each pairs passed in parameters, download the ticker intervals"""
for pair in pairs:
try:
download_backtesting_testdata(datadir=datadir,
exchange=exchange,
pair=pair,
tick_interval=ticker_interval,
timerange=timerange)
except BaseException:
logger.info('Failed to download the pair: "%s", Interval: %s',
pair, ticker_interval)
return False
return True
def load_cached_data_for_updating(filename: Path, tick_interval: str, def load_cached_data_for_updating(filename: Path, tick_interval: str,
timerange: Optional[TimeRange]) -> Tuple[List[Any], timerange: Optional[TimeRange]) -> Tuple[List[Any],
Optional[int]]: Optional[int]]:
@ -220,11 +202,11 @@ def load_cached_data_for_updating(filename: Path, tick_interval: str,
return (data, since_ms) return (data, since_ms)
def download_backtesting_testdata(datadir: Path, def download_backtesting_testdata(datadir: Optional[Path],
exchange: Exchange, exchange: Exchange,
pair: str, pair: str,
tick_interval: str = '5m', tick_interval: str = '5m',
timerange: Optional[TimeRange] = None) -> None: timerange: Optional[TimeRange] = None) -> bool:
""" """
Download the latest ticker intervals from the exchange for the pair passed in parameters Download the latest ticker intervals from the exchange for the pair passed in parameters
The data is downloaded starting from the last correct ticker interval data that The data is downloaded starting from the last correct ticker interval data that
@ -238,6 +220,7 @@ def download_backtesting_testdata(datadir: Path,
:return: None :return: None
""" """
try:
path = make_testdata_path(datadir) path = make_testdata_path(datadir)
filepair = pair.replace("/", "_") filepair = pair.replace("/", "_")
filename = path.joinpath(f'{filepair}-{tick_interval}.json') filename = path.joinpath(f'{filepair}-{tick_interval}.json')
@ -260,3 +243,8 @@ def download_backtesting_testdata(datadir: Path,
logger.debug("New End: %s", misc.format_ms_time(data[-1][0])) logger.debug("New End: %s", misc.format_ms_time(data[-1][0]))
misc.file_dump_json(filename, data) misc.file_dump_json(filename, data)
return True
except BaseException:
logger.info('Failed to download the pair: "%s", Interval: %s',
pair, tick_interval)
return False