Remove redundant refresh_pair_history

This commit is contained in:
hroff-1902 2019-12-17 14:06:21 +03:00
parent 60f89c8c01
commit b2796f99b6
2 changed files with 8 additions and 37 deletions

View File

@ -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:

View File

@ -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)