diff --git a/freqtrade/commands/data_commands.py b/freqtrade/commands/data_commands.py index c529e8dc7..d4354e058 100644 --- a/freqtrade/commands/data_commands.py +++ b/freqtrade/commands/data_commands.py @@ -32,13 +32,16 @@ def start_download_data(args: dict[str, Any]) -> None: """ from freqtrade.configuration import setup_utils_configuration from freqtrade.data.history import download_data_main + from freqtrade.resolvers.exchange_resolver import ExchangeResolver config = setup_utils_configuration(args, RunMode.UTIL_EXCHANGE) _check_data_config_download_sanity(config) + exchange = ExchangeResolver.load_exchange(config, validate=False) + try: - download_data_main(config) + download_data_main(config, exchange) except KeyboardInterrupt: sys.exit("SIGINT received, aborting ...") diff --git a/freqtrade/data/history/history_utils.py b/freqtrade/data/history/history_utils.py index 66b4d82bd..fb63e58d7 100644 --- a/freqtrade/data/history/history_utils.py +++ b/freqtrade/data/history/history_utils.py @@ -579,7 +579,7 @@ def validate_backtest_data( return found_missing -def download_data_main(config: Config) -> None: +def download_data_main(config: Config, exchange: Exchange) -> None: timerange = TimeRange() if "days" in config: time_since = (datetime.now() - timedelta(days=config["days"])).strftime("%Y%m%d") @@ -593,10 +593,6 @@ def download_data_main(config: Config) -> None: pairs_not_available: list[str] = [] - # Init exchange - from freqtrade.resolvers.exchange_resolver import ExchangeResolver - - exchange = ExchangeResolver.load_exchange(config, validate=False) available_pairs = [ p for p in exchange.get_markets(