add lock to any historic data access

This commit is contained in:
robcaulk 2022-06-07 00:54:18 +02:00
parent 3c2e314ee5
commit 4b26b6aaec
2 changed files with 11 additions and 8 deletions

View File

@ -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:

View File

@ -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: