fix follower bug

This commit is contained in:
robcaulk 2022-06-05 04:40:58 +02:00
parent e8c0dcf9f3
commit d6b8801f41
2 changed files with 17 additions and 17 deletions

View File

@ -638,8 +638,8 @@ class FreqaiDataKitchen:
) )
logger.info( logger.info(
"DI tossed %s predictions for being too far from training data", f'DI tossed {len(do_predict) - do_predict.sum():.2f} predictions for '
len(do_predict) - do_predict.sum(), 'being too far from training data'
) )
self.do_predict += do_predict self.do_predict += do_predict
@ -743,7 +743,7 @@ class FreqaiDataKitchen:
logger.warning('FreqAI could not detect max timeframe and therefore may not ' logger.warning('FreqAI could not detect max timeframe and therefore may not '
'download the proper amount of data for training') 'download the proper amount of data for training')
logger.info(f'Extending data download by {additional_seconds/SECONDS_IN_DAY} days') logger.info(f'Extending data download by {additional_seconds/SECONDS_IN_DAY:.2f} days')
if trained_timestamp != 0: if trained_timestamp != 0:
elapsed_time = (time - trained_timestamp) / SECONDS_IN_DAY elapsed_time = (time - trained_timestamp) / SECONDS_IN_DAY
@ -770,12 +770,13 @@ class FreqaiDataKitchen:
data_load_timerange.stopts = int(time) data_load_timerange.stopts = int(time)
retrain = True retrain = True
logger.info(f'Total data download needed ' # logger.info(
f'{(data_load_timerange.stopts - data_load_timerange.startts)/SECONDS_IN_DAY} ' # f'Total data download needed '
' days') # f'{(data_load_timerange.stopts - data_load_timerange.startts)/SECONDS_IN_DAY:.2f}'
logger.info(f'Total training timerange ' # ' days')
f'{(trained_timerange.stopts - trained_timerange.startts)/SECONDS_IN_DAY} ' # logger.info(f'Total training timerange '
' days') # f'{(trained_timerange.stopts - trained_timerange.startts)/SECONDS_IN_DAY} '
# ' days')
# if retrain: # if retrain:
# coin, _ = metadata['pair'].split("/") # coin, _ = metadata['pair'].split("/")
@ -861,11 +862,10 @@ class FreqaiDataKitchen:
for pair in self.all_pairs: for pair in self.all_pairs:
for tf in self.freqai_config.get('timeframes'): for tf in self.freqai_config.get('timeframes'):
history_data[pair][tf] = pd.concat( lh = len(history_data[pair][tf].index)
[history_data[pair][tf], history_data[pair][tf].loc[lh] = strategy.dp.get_pair_dataframe(pair, tf).iloc[-1]
strategy.dp.get_pair_dataframe(pair, tf).iloc[-1]],
axis=0 logger.info(f'Length of history data {len(history_data[pair][tf])}')
)
def set_all_pairs(self) -> None: def set_all_pairs(self) -> None:

View File

@ -226,7 +226,7 @@ class IFreqaiModel(ABC):
# if trainable, check if model needs training, if so compute new timerange, # if trainable, check if model needs training, if so compute new timerange,
# then save model and metadata. # then save model and metadata.
# if not trainable, load existing data # if not trainable, load existing data
if (trainable and not self.follow_mode) or coin_first: if (trainable or coin_first) and not self.follow_mode:
file_exists = False file_exists = False
if trained_timestamp != 0: # historical model available if trained_timestamp != 0: # historical model available
@ -416,8 +416,8 @@ class IFreqaiModel(ABC):
metadata) metadata)
unfiltered_dataframe = dh.slice_dataframe(new_trained_timerange, unfiltered_dataframe) unfiltered_dataframe = dh.slice_dataframe(new_trained_timerange, unfiltered_dataframe)
except Exception: except Exception as err:
logger.warning('Mismatched sizes encountered in strategy') logger.exception(err)
# self.data_drawer.pair_to_end_of_training_queue(metadata['pair']) # self.data_drawer.pair_to_end_of_training_queue(metadata['pair'])
self.training_on_separate_thread = False self.training_on_separate_thread = False
self.retrain = False self.retrain = False