Fixes a download_data bug when in futures mode.

When specifying multiple pairs to download, the json filenames were
inconsistent due to the reassignment of candle_type. Also adds the
candle_type being downloaded to a log message.
This commit is contained in:
Wade Dyck 2021-12-27 11:16:38 -07:00
parent 90c565006b
commit 5b3f907b0c

View File

@ -198,8 +198,8 @@ def _download_pair_history(pair: str, *,
try: try:
logger.info( logger.info(
f'Download history data for pair: "{pair}" ({process}), timeframe: {timeframe} ' f'Download history data for pair: "{pair}" ({process}), timeframe: {timeframe}, '
f'and store in {datadir}.' f'candle type: {candle_type} and store in {datadir}.'
) )
# data, since_ms = _load_cached_data_for_updating_old(datadir, pair, timeframe, timerange) # data, since_ms = _load_cached_data_for_updating_old(datadir, pair, timeframe, timerange)
@ -286,17 +286,17 @@ def refresh_backtest_ohlcv_data(exchange: Exchange, pairs: List[str], timeframes
fr_candle_type = CandleType.from_string(exchange._ft_has['mark_ohlcv_price']) fr_candle_type = CandleType.from_string(exchange._ft_has['mark_ohlcv_price'])
# All exchanges need FundingRate for futures trading. # All exchanges need FundingRate for futures trading.
# The timeframe is aligned to the mark-price timeframe. # The timeframe is aligned to the mark-price timeframe.
for candle_type in (CandleType.FUNDING_RATE, fr_candle_type): for funding_candle_type in (CandleType.FUNDING_RATE, fr_candle_type):
# TODO: this could be in most parts to the above. # TODO: this could be in most parts to the above.
if erase: if erase:
if data_handler.ohlcv_purge(pair, timeframe, candle_type=candle_type): if data_handler.ohlcv_purge(pair, timeframe, candle_type=funding_candle_type):
logger.info( logger.info(
f'Deleting existing data for pair {pair}, interval {timeframe}.') f'Deleting existing data for pair {pair}, interval {timeframe}.')
_download_pair_history(pair=pair, process=process, _download_pair_history(pair=pair, process=process,
datadir=datadir, exchange=exchange, datadir=datadir, exchange=exchange,
timerange=timerange, data_handler=data_handler, timerange=timerange, data_handler=data_handler,
timeframe=str(timeframe), new_pairs_days=new_pairs_days, timeframe=str(timeframe), new_pairs_days=new_pairs_days,
candle_type=candle_type) candle_type=funding_candle_type)
return pairs_not_available return pairs_not_available