extract download-data from freqai to prepare for future async changes

This commit is contained in:
robcaulk
2022-08-17 15:18:44 +02:00
parent 83ca168bb8
commit 0c34104e45
3 changed files with 94 additions and 33 deletions

View File

@@ -149,9 +149,20 @@ class IStrategy(ABC, HyperStrategyMixin):
if self.config.get('freqai', {}).get('enabled', False):
# Import here to avoid importing this if freqAI is disabled
from freqtrade.resolvers.freqaimodel_resolver import FreqaiModelResolver
from freqtrade.freqai.data_kitchen import (get_required_data_timerange,
download_all_data_for_training)
self.freqai = FreqaiModelResolver.load_freqaimodel(self.config)
self.freqai_info = self.config["freqai"]
# download the desired data in dry/live
if self.config.get('runmode') in (RunMode.DRY_RUN, RunMode.LIVE):
logger.info(
"Downloading all training data for all pairs in whitelist and "
"corr_pairlist, this may take a while if you do not have the "
"data saved"
)
data_load_timerange = get_required_data_timerange(self.config)
download_all_data_for_training(data_load_timerange, self.dp, self.config)
else:
# Gracious failures if freqAI is disabled but "start" is called.
class DummyClass():