diff --git a/freqtrade/data/history.py b/freqtrade/data/history.py index 412b086c0..b1e4313ca 100644 --- a/freqtrade/data/history.py +++ b/freqtrade/data/history.py @@ -148,7 +148,6 @@ def load_pair_history(pair: str, timerange_startup = deepcopy(timerange) if startup_candles > 0 and timerange_startup: - logger.info('Using indicator startup period: %s ...', startup_candles) timerange_startup.subtract_start(timeframe_to_seconds(ticker_interval) * startup_candles) # The user forced the refresh of pairs @@ -204,6 +203,8 @@ def load_data(datadir: Path, exchange and refresh_pairs are then not needed here nor in load_pair_history. """ result: Dict[str, DataFrame] = {} + if startup_candles > 0 and timerange: + logger.info(f'Using indicator startup period: {startup_candles} ...') for pair in pairs: hist = load_pair_history(pair=pair, ticker_interval=ticker_interval, diff --git a/tests/data/test_history.py b/tests/data/test_history.py index d9627a0e4..89120b4f5 100644 --- a/tests/data/test_history.py +++ b/tests/data/test_history.py @@ -103,9 +103,7 @@ def test_load_data_startup_candles(mocker, caplog, default_conf, testdatadir) -> datadir=testdatadir, timerange=timerange, startup_candles=20, ) - assert log_has( - 'Using indicator startup period: 20 ...', caplog - ) + assert ltfmock.call_count == 1 assert ltfmock.call_args_list[0][1]['timerange'] != timerange # startts is 20 minutes earlier @@ -354,8 +352,12 @@ def test_load_partial_missing(testdatadir, caplog) -> None: start = arrow.get('2018-01-01T00:00:00') end = arrow.get('2018-01-11T00:00:00') tickerdata = history.load_data(testdatadir, '5m', ['UNITTEST/BTC'], + startup_candles=20, timerange=TimeRange('date', 'date', start.timestamp, end.timestamp)) + assert log_has( + 'Using indicator startup period: 20 ...', caplog + ) # timedifference in 5 minutes td = ((end - start).total_seconds() // 60 // 5) + 1 assert td != len(tickerdata['UNITTEST/BTC'])