Increase performance by only predicting on most recent candle instead of full strat provided dataframe. Collect predictions and store them so that we can feed true predictions back to strategy (so that frequi isnt updating historic predictions based on newly trained models).

This commit is contained in:
robcaulk
2022-05-30 11:37:05 +02:00
parent 2f1a2c1cd7
commit a20651efd8
3 changed files with 37 additions and 3 deletions

View File

@@ -219,8 +219,16 @@ class IFreqaiModel(ABC):
self.check_if_feature_list_matches_strategy(dataframe, dh)
preds, do_preds = self.predict(dataframe, dh)
dh.append_predictions(preds, do_preds, len(dataframe))
if metadata['pair'] not in self.data_drawer.model_return_values:
preds, do_preds = self.predict(dataframe, dh)
dh.append_predictions(preds, do_preds, len(dataframe))
dh.fill_predictions(len(dataframe))
self.data_drawer.set_initial_return_values(metadata['pair'], dh)
else:
preds, do_preds = self.predict(dataframe.iloc[-2:], dh)
self.data_drawer.append_model_predictions(metadata['pair'], preds, do_preds,
self.dh.data["target_mean"],
self.dh.data["target_std"], dh)
return dh