mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
refactor: extract exchangeInit from download-data main
This commit is contained in:
@@ -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 ...")
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user