Merge pull request #6127 from wadedyck/download_data_futures_fix

Download data futures fix
This commit is contained in:
Matthias 2021-12-29 19:08:38 +01:00 committed by GitHub
commit 1871165d21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 7 deletions

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

View File

@ -196,6 +196,7 @@ class Backtesting:
startup_candles=self.required_startup, startup_candles=self.required_startup,
fail_without_data=True, fail_without_data=True,
data_format=self.config.get('dataformat_ohlcv', 'json'), data_format=self.config.get('dataformat_ohlcv', 'json'),
candle_type=self.config.get('candle_type_def', CandleType.SPOT)
) )
min_date, max_date = history.get_timerange(data) min_date, max_date = history.get_timerange(data)
@ -224,6 +225,7 @@ class Backtesting:
startup_candles=0, startup_candles=0,
fail_without_data=True, fail_without_data=True,
data_format=self.config.get('dataformat_ohlcv', 'json'), data_format=self.config.get('dataformat_ohlcv', 'json'),
candle_type=self.config.get('candle_type_def', CandleType.SPOT)
) )
else: else:
self.detail_data = {} self.detail_data = {}

View File

@ -148,8 +148,8 @@ def test_load_data_with_new_pair_1min(ohlcv_history_list, mocker, caplog,
load_pair_history(datadir=tmpdir1, timeframe='1m', pair='MEME/BTC', candle_type=candle_type) load_pair_history(datadir=tmpdir1, timeframe='1m', pair='MEME/BTC', candle_type=candle_type)
assert file.is_file() assert file.is_file()
assert log_has_re( assert log_has_re(
r'Download history data for pair: "MEME/BTC" \(0/1\), timeframe: 1m ' r'Download history data for pair: "MEME/BTC" \(0/1\), timeframe: 1m, '
r'and store in .*', caplog r'candle type: spot and store in .*', caplog
) )