From b2796f99b6c9be25af7a86cf67a2740641879cdd Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Tue, 17 Dec 2019 14:06:21 +0300 Subject: [PATCH] Remove redundant refresh_pair_history --- freqtrade/data/history.py | 35 +++-------------------------------- tests/data/test_history.py | 10 +++++----- 2 files changed, 8 insertions(+), 37 deletions(-) diff --git a/freqtrade/data/history.py b/freqtrade/data/history.py index 62195a005..3b16e41a9 100644 --- a/freqtrade/data/history.py +++ b/freqtrade/data/history.py @@ -164,34 +164,6 @@ def load_pair_history(pair: str, return DataFrame() -def refresh_pair_history(pair: str, - timeframe: str, - datadir: Path, - exchange: Exchange, - timerange: Optional[TimeRange] = None, - startup_candles: int = 0, - ) -> None: - """ - Refresh cached ticker history for the given pair. - - :param pair: Pair to load data for - :param timeframe: Ticker timeframe (e.g. "5m") - :param datadir: Path to the data storage location. - :param timerange: Limit data to be loaded to this timerange - :param exchange: Exchange object - :param startup_candles: Additional candles to load at the start of the period - """ - timerange_startup = deepcopy(timerange) - if startup_candles > 0 and timerange_startup: - timerange_startup.subtract_start(timeframe_to_seconds(timeframe) * startup_candles) - - _download_pair_history(datadir=datadir, - exchange=exchange, - pair=pair, - timeframe=timeframe, - timerange=timerange) - - def load_data(datadir: Path, timeframe: str, pairs: List[str], @@ -250,10 +222,9 @@ def refresh_data(datadir: Path, logger.info(f'Using indicator startup period: {startup_candles} ...') for pair in pairs: - refresh_pair_history(pair=pair, timeframe=timeframe, - datadir=datadir, timerange=timerange, - exchange=exchange, - startup_candles=startup_candles) + _download_pair_history(pair=pair, timeframe=timeframe, + datadir=datadir, timerange=timerange, + exchange=exchange) def pair_data_filename(datadir: Path, pair: str, timeframe: str) -> Path: diff --git a/tests/data/test_history.py b/tests/data/test_history.py index 1b7c2c4a4..c9b198b39 100644 --- a/tests/data/test_history.py +++ b/tests/data/test_history.py @@ -21,7 +21,7 @@ from freqtrade.data.history import (_download_pair_history, pair_trades_filename, refresh_backtest_ohlcv_data, refresh_backtest_trades_data, - refresh_data, refresh_pair_history, + refresh_data, trim_dataframe, trim_tickerlist, validate_backtest_data) from freqtrade.exchange import timeframe_to_minutes @@ -130,8 +130,8 @@ def test_load_data_with_new_pair_1min(ticker_history_list, mocker, caplog, ) # download a new pair if refresh_pairs is set - refresh_pair_history(datadir=testdatadir, timeframe='1m', pair='MEME/BTC', - exchange=exchange) + refresh_data(datadir=testdatadir, timeframe='1m', pairs=['MEME/BTC'], + exchange=exchange) load_pair_history(datadir=testdatadir, timeframe='1m', pair='MEME/BTC') assert file.is_file() assert log_has_re( @@ -139,8 +139,8 @@ def test_load_data_with_new_pair_1min(ticker_history_list, mocker, caplog, 'and store in .*', caplog ) with pytest.raises(OperationalException, match=r'Exchange needs to be initialized when.*'): - refresh_pair_history(datadir=testdatadir, timeframe='1m', pair='MEME/BTC', - exchange=None) + refresh_data(datadir=testdatadir, timeframe='1m', pairs=['MEME/BTC'], + exchange=None) _clean_test_file(file)