mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 02:12:01 +00:00
Compare commits
18 Commits
e89c3f4a59
...
12ef588bd6
Author | SHA1 | Date | |
---|---|---|---|
|
12ef588bd6 | ||
|
d7b86ee436 | ||
|
7a04f876c3 | ||
|
0ef7e9db13 | ||
|
ac5c22d0bc | ||
|
98ef62cb46 | ||
|
45c8161448 | ||
|
62c64e2467 | ||
|
fce4536ef2 | ||
|
0008a87232 | ||
|
116bcc2bce | ||
|
778add6d92 | ||
|
5782124df9 | ||
|
c5e68afb2c | ||
|
49487afc86 | ||
|
4b9f0c2fc2 | ||
|
a72587576e | ||
|
c537c43dd0 |
|
@ -70,7 +70,7 @@ class IFreqaiModel(ABC):
|
|||
self.retrain = False
|
||||
self.first = True
|
||||
self.set_full_path()
|
||||
self.save_backtest_models: bool = self.freqai_info.get("save_backtest_models", True)
|
||||
self.save_backtest_models: bool = self.freqai_info.get("save_backtest_models", False)
|
||||
if self.save_backtest_models:
|
||||
logger.info("Backtesting module configured to save all models.")
|
||||
|
||||
|
@ -258,6 +258,23 @@ class IFreqaiModel(ABC):
|
|||
if self.freqai_info.get("write_metrics_to_disk", False):
|
||||
self.dd.save_metric_tracker_to_disk()
|
||||
|
||||
def _train_model(self, dataframe_train, pair, dk, tr_backtest):
|
||||
try:
|
||||
self.tb_logger = get_tb_logger(
|
||||
self.dd.model_type, dk.data_path, self.activate_tensorboard
|
||||
)
|
||||
model = self.train(dataframe_train, pair, dk)
|
||||
self.tb_logger.close()
|
||||
return model
|
||||
except Exception as msg:
|
||||
logger.warning(
|
||||
f"Training {pair} raised exception {msg.__class__.__name__}. "
|
||||
f"from {tr_backtest.start_fmt} to {tr_backtest.stop_fmt}."
|
||||
f"Message: {msg}, skipping.",
|
||||
exc_info=True,
|
||||
)
|
||||
return None
|
||||
|
||||
def start_backtesting(
|
||||
self, dataframe: DataFrame, metadata: dict, dk: FreqaiDataKitchen, strategy: IStrategy
|
||||
) -> FreqaiDataKitchen:
|
||||
|
@ -352,21 +369,9 @@ class IFreqaiModel(ABC):
|
|||
if not self.model_exists(dk):
|
||||
dk.find_features(dataframe_train)
|
||||
dk.find_labels(dataframe_train)
|
||||
self.model = self._train_model(dataframe_train, pair, dk, tr_backtest)
|
||||
|
||||
try:
|
||||
self.tb_logger = get_tb_logger(
|
||||
self.dd.model_type, dk.data_path, self.activate_tensorboard
|
||||
)
|
||||
self.model = self.train(dataframe_train, pair, dk)
|
||||
self.tb_logger.close()
|
||||
except Exception as msg:
|
||||
logger.warning(
|
||||
f"Training {pair} raised exception {msg.__class__.__name__}. "
|
||||
f"Message: {msg}, skipping.",
|
||||
exc_info=True,
|
||||
)
|
||||
self.model = None
|
||||
|
||||
if self.model:
|
||||
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)
|
||||
|
@ -379,6 +384,7 @@ class IFreqaiModel(ABC):
|
|||
else:
|
||||
self.model = self.dd.load_data(pair, dk)
|
||||
|
||||
if self.model and len(dataframe_backtest):
|
||||
pred_df, do_preds = self.predict(dataframe_backtest, dk)
|
||||
append_df = dk.get_predictions_to_append(pred_df, do_preds, dataframe_backtest)
|
||||
dk.append_predictions(append_df)
|
||||
|
@ -829,7 +835,7 @@ class IFreqaiModel(ABC):
|
|||
:param pair: current pair
|
||||
:return: if the data exists or not
|
||||
"""
|
||||
if self.config.get("freqai_backtest_live_models", False) and len_dataframe_backtest == 0:
|
||||
if len_dataframe_backtest == 0:
|
||||
logger.info(
|
||||
f"No data found for pair {pair} from "
|
||||
f"from {tr_backtest.start_fmt} to {tr_backtest.stop_fmt}. "
|
||||
|
|
Loading…
Reference in New Issue
Block a user