From d6b8801f413be4f1c405314473a9d5efda3b959b Mon Sep 17 00:00:00 2001 From: robcaulk Date: Sun, 5 Jun 2022 04:40:58 +0200 Subject: [PATCH] fix follower bug --- freqtrade/freqai/data_kitchen.py | 28 ++++++++++++++-------------- freqtrade/freqai/freqai_interface.py | 6 +++--- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/freqtrade/freqai/data_kitchen.py b/freqtrade/freqai/data_kitchen.py index 5c26b0598..4f68326fc 100644 --- a/freqtrade/freqai/data_kitchen.py +++ b/freqtrade/freqai/data_kitchen.py @@ -638,8 +638,8 @@ class FreqaiDataKitchen: ) logger.info( - "DI tossed %s predictions for being too far from training data", - len(do_predict) - do_predict.sum(), + f'DI tossed {len(do_predict) - do_predict.sum():.2f} predictions for ' + 'being too far from training data' ) self.do_predict += do_predict @@ -743,7 +743,7 @@ class FreqaiDataKitchen: logger.warning('FreqAI could not detect max timeframe and therefore may not ' '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: elapsed_time = (time - trained_timestamp) / SECONDS_IN_DAY @@ -770,12 +770,13 @@ class FreqaiDataKitchen: data_load_timerange.stopts = int(time) retrain = True - logger.info(f'Total data download needed ' - f'{(data_load_timerange.stopts - data_load_timerange.startts)/SECONDS_IN_DAY} ' - ' days') - logger.info(f'Total training timerange ' - f'{(trained_timerange.stopts - trained_timerange.startts)/SECONDS_IN_DAY} ' - ' days') + # logger.info( + # f'Total data download needed ' + # f'{(data_load_timerange.stopts - data_load_timerange.startts)/SECONDS_IN_DAY:.2f}' + # ' days') + # logger.info(f'Total training timerange ' + # f'{(trained_timerange.stopts - trained_timerange.startts)/SECONDS_IN_DAY} ' + # ' days') # if retrain: # coin, _ = metadata['pair'].split("/") @@ -861,11 +862,10 @@ class FreqaiDataKitchen: for pair in self.all_pairs: for tf in self.freqai_config.get('timeframes'): - history_data[pair][tf] = pd.concat( - [history_data[pair][tf], - strategy.dp.get_pair_dataframe(pair, tf).iloc[-1]], - axis=0 - ) + 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])}') def set_all_pairs(self) -> None: diff --git a/freqtrade/freqai/freqai_interface.py b/freqtrade/freqai/freqai_interface.py index 04e819cc4..e192f9b0a 100644 --- a/freqtrade/freqai/freqai_interface.py +++ b/freqtrade/freqai/freqai_interface.py @@ -226,7 +226,7 @@ class IFreqaiModel(ABC): # if trainable, check if model needs training, if so compute new timerange, # then save model and metadata. # 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 if trained_timestamp != 0: # historical model available @@ -416,8 +416,8 @@ class IFreqaiModel(ABC): metadata) unfiltered_dataframe = dh.slice_dataframe(new_trained_timerange, unfiltered_dataframe) - except Exception: - logger.warning('Mismatched sizes encountered in strategy') + except Exception as err: + logger.exception(err) # self.data_drawer.pair_to_end_of_training_queue(metadata['pair']) self.training_on_separate_thread = False self.retrain = False