remove new feature flag

This commit is contained in:
Aleksey Savin 2024-04-23 18:48:01 +00:00
parent a72587576e
commit 4b9f0c2fc2
2 changed files with 13 additions and 35 deletions

View File

@ -48,7 +48,6 @@
], ],
"freqai": { "freqai": {
"enabled": true, "enabled": true,
"warn_exceptions_on_backtest_only": false,
"purge_old_models": 2, "purge_old_models": 2,
"train_period_days": 15, "train_period_days": 15,
"backtest_period_days": 7, "backtest_period_days": 7,

View File

@ -116,9 +116,6 @@ class IFreqaiModel(ABC):
record_params(config, self.full_path) record_params(config, self.full_path)
self.new_feature_selector = self.config.get('freqai', {}) \
.get('warn_exceptions_on_backtest_only', False)
def __getstate__(self): def __getstate__(self):
""" """
Return an empty state to be pickled in hyperopt Return an empty state to be pickled in hyperopt
@ -357,43 +354,25 @@ class IFreqaiModel(ABC):
logger.warning( logger.warning(
f"Training {pair} raised exception {msg.__class__.__name__}. " f"Training {pair} raised exception {msg.__class__.__name__}. "
f"Message: {msg}, skipping.", exc_info=True) f"Message: {msg}, skipping.", exc_info=True)
if self.new_feature_selector:
logger.warning(
"Train failed. Try to train on next pair." \
if self.new_feature_selector else
"Train failed. Raise error, fix data issue and try again."
)
self.tb_logger.close()
self.model = None self.model = None
hard_check_model_valid = True self.dd.pair_dict[pair]["trained_timestamp"] = int(tr_train.stopts)
if self.new_feature_selector: if self.plot_features and self.model is not None:
hard_check_model_valid = bool(False if self.model is None else True) plot_feature_importance(self.model, pair, dk, self.plot_features)
if hard_check_model_valid: if self.save_backtest_models and self.model is not None:
logger.info( logger.info('Saving backtest model to disk.')
"Model is trained. Saving model and metadata to disk." self.dd.save_data(self.model, pair, dk)
) else:
logger.info('Saving metadata to disk.')
if hard_check_model_valid: self.dd.save_metadata(dk)
self.dd.pair_dict[pair]["trained_timestamp"] = int(tr_train.stopts)
if self.plot_features and self.model is not None:
plot_feature_importance(self.model, pair, dk, self.plot_features)
if self.save_backtest_models and self.model is not None:
logger.info('Saving backtest model to disk.')
self.dd.save_data(self.model, pair, dk)
else:
logger.info('Saving metadata to disk.')
self.dd.save_metadata(dk)
else: else:
self.model = self.dd.load_data(pair, dk) self.model = self.dd.load_data(pair, dk)
if hard_check_model_valid: pred_df, do_preds = self.predict(dataframe_backtest, dk)
pred_df, do_preds = self.predict(dataframe_backtest, dk) append_df = dk.get_predictions_to_append(pred_df, do_preds, dataframe_backtest)
append_df = dk.get_predictions_to_append(pred_df, do_preds, dataframe_backtest) dk.append_predictions(append_df)
dk.append_predictions(append_df) dk.save_backtesting_prediction(append_df)
dk.save_backtesting_prediction(append_df)
self.backtesting_fit_live_predictions(dk) self.backtesting_fit_live_predictions(dk)
dk.fill_predictions(dataframe) dk.fill_predictions(dataframe)