feat(data-dl): Simplify download-data calls

This commit is contained in:
Matthias
2024-10-24 18:17:01 +02:00
parent 3690609519
commit 3b25bdc1cb
2 changed files with 13 additions and 5 deletions

View File

@@ -32,16 +32,13 @@ 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, exchange)
download_data_main(config)
except KeyboardInterrupt:
sys.exit("SIGINT received, aborting ...")

View File

@@ -579,7 +579,18 @@ def validate_backtest_data(
return found_missing
def download_data_main(config: Config, exchange: Exchange) -> None:
def download_data_main(config: Config) -> None:
from freqtrade.resolvers.exchange_resolver import ExchangeResolver
exchange = ExchangeResolver.load_exchange(config, validate=False)
download_data(config, exchange)
def download_data(config: Config, exchange: Exchange) -> None:
"""
Download data function. Used from both cli and API.
"""
timerange = TimeRange()
if "days" in config:
time_since = (datetime.now() - timedelta(days=config["days"])).strftime("%Y%m%d")