From fe199a46ed786f3a7a56346311ad3c76ee3fb26b Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 09:59:06 +0000 Subject: [PATCH] fix: Guard timeframe validation loop against empty list Return early from `_build_ohlcv_dl_jobs` if `pair_list` is empty. This prevents unconditional access to `self.timeframes` (which was introduced by the optimization), ensuring that tests or scenarios with uninitialized/mocked exchanges and empty pair lists do not crash. Co-authored-by: Corax-CoLAB <239841157+Corax-CoLAB@users.noreply.github.com> --- freqtrade/exchange/exchange.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index d236b18d3..10b923e9a 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -2732,6 +2732,9 @@ class Exchange: """ input_coroutines: list[Coroutine[Any, Any, OHLCVResponse]] = [] cached_pairs = [] + if not pair_list: + return input_coroutines, cached_pairs + # optimization: cache timeframes as a set outside the loop to avoid repeated property access # and linear search available_timeframes = set(self.timeframes)