diff --git a/freqtrade/freqai/data_kitchen.py b/freqtrade/freqai/data_kitchen.py index 4f68326fc..32ea0e6ac 100644 --- a/freqtrade/freqai/data_kitchen.py +++ b/freqtrade/freqai/data_kitchen.py @@ -858,14 +858,16 @@ class FreqaiDataKitchen: dataframe: DataFrame = strategy provided dataframe """ - history_data = self.data_drawer.historic_data + with self.data_drawer.history_lock: + history_data = self.data_drawer.historic_data - for pair in self.all_pairs: - for tf in self.freqai_config.get('timeframes'): - lh = len(history_data[pair][tf].index) - history_data[pair][tf].loc[lh] = strategy.dp.get_pair_dataframe(pair, tf).iloc[-1] + for pair in self.all_pairs: + for tf in self.freqai_config.get('timeframes'): + lh = len(history_data[pair][tf].index) + history_data[pair][tf].loc[lh] = strategy.dp.get_pair_dataframe(pair, + tf).iloc[-1] - logger.info(f'Length of history data {len(history_data[pair][tf])}') + logger.info(f'Length of history data {len(history_data[pair][tf])}') def set_all_pairs(self) -> None: diff --git a/freqtrade/freqai/freqai_interface.py b/freqtrade/freqai/freqai_interface.py index e192f9b0a..e74f2b92d 100644 --- a/freqtrade/freqai/freqai_interface.py +++ b/freqtrade/freqai/freqai_interface.py @@ -405,8 +405,9 @@ class IFreqaiModel(ABC): # dh.download_new_data_for_retraining(data_load_timerange, metadata, strategy) # corr_dataframes, base_dataframes = dh.load_pairs_histories(data_load_timerange, # metadata) - corr_dataframes, base_dataframes = dh.get_base_and_corr_dataframes(data_load_timerange, - metadata) + with self.data_drawer.history_lock: + corr_dataframes, base_dataframes = dh.get_base_and_corr_dataframes(data_load_timerange, + metadata) # protecting from common benign errors associated with grabbing new data from exchange: try: