Merge branch 'feat/freqai' of https://github.com/freqtrade/freqtrade into feat/freqai

This commit is contained in:
longyu 2022-07-10 09:06:17 +02:00
commit 97b0c4382a
3 changed files with 6 additions and 23 deletions

View File

@ -48,15 +48,6 @@ class FreqaiDataKitchen:
self.data_dictionary: Dict[Any, Any] = {}
self.config = config
self.freqai_config = config["freqai"]
# self.predictions: npt.ArrayLike = np.array([])
# self.do_predict: npt.ArrayLike = np.array([])
# self.target_mean: npt.ArrayLike = np.array([])
# self.target_std: npt.ArrayLike = np.array([])
# self.full_predictions: npt.ArrayLike = np.array([])
# self.full_do_predict: npt.ArrayLike = np.array([])
# self.full_DI_values: npt.ArrayLike = np.array([])
# self.full_target_mean: npt.ArrayLike = np.array([])
# self.full_target_std: npt.ArrayLike = np.array([])
self.full_df: DataFrame = DataFrame()
self.append_df: DataFrame = DataFrame()
self.data_path = Path()

View File

@ -125,16 +125,7 @@ class IFreqaiModel(ABC):
if self.dd.pair_dict[pair]["priority"] != 1:
continue
dk = FreqaiDataKitchen(self.config, self.dd, self.live, pair)
# file_exists = False
dk.set_paths(pair, trained_timestamp)
# file_exists = self.model_exists(pair,
# dk,
# trained_timestamp=trained_timestamp,
# model_filename=model_filename,
# scanning=True)
(
retrain,
new_trained_timerange,
@ -142,7 +133,7 @@ class IFreqaiModel(ABC):
) = dk.check_if_new_training_required(trained_timestamp)
dk.set_paths(pair, new_trained_timerange.stopts)
if retrain: # or not file_exists:
if retrain:
self.train_model_in_series(
new_trained_timerange, pair, strategy, dk, data_load_timerange
)
@ -214,7 +205,6 @@ class IFreqaiModel(ABC):
pred_df, do_preds = self.predict(dataframe_backtest, dk)
dk.append_predictions(pred_df, do_preds, len(dataframe_backtest))
# print("predictions", len(dk.full_predictions), "do_predict", len(dk.full_do_predict))
dk.fill_predictions(dataframe)
@ -288,7 +278,9 @@ class IFreqaiModel(ABC):
self.model = dk.load_data(coin=metadata["pair"], keras_model=self.keras)
if not self.model:
logger.warning("No model ready, returning null values to strategy.")
logger.warning(
f"No model ready for {metadata['pair']}, returning null values to strategy."
)
self.dd.return_null_values_to_strategy(dataframe, dk)
return dk

View File

@ -104,9 +104,9 @@ class LightGBMPredictionModel(IFreqaiModel):
# logger.info("--------------------Starting prediction--------------------")
original_feature_list = dk.find_features(unfiltered_dataframe)
dk.find_features(unfiltered_dataframe)
filtered_dataframe, _ = dk.filter_features(
unfiltered_dataframe, original_feature_list, training_filter=False
unfiltered_dataframe, dk.training_features_list, training_filter=False
)
filtered_dataframe = dk.normalize_data_from_metadata(filtered_dataframe)
dk.data_dictionary["prediction_features"] = filtered_dataframe