add test and exception handling for load_pipeline in multi_bar

Co-authored-by: maghdam <63883156+maghdam@users.noreply.github.com>
This commit is contained in:
google-labs-jules[bot]
2026-03-11 18:33:36 +00:00
co-authored by maghdam
parent 29fcbf0f9d
commit 93718212fa
2 changed files with 55 additions and 3 deletions
+7 -3
View File
@@ -101,9 +101,13 @@ class TradingApp:
Loads a pre-trained classification pipeline (e.g., 'best_rf_pipeline.pkl').
This pipeline is expected to produce SHIFTED labels [0,1,2].
"""
self.pipeline = joblib.load(pipeline_path)
logging.info(f"Loaded pipeline from {pipeline_path}")
log_and_print(f"Loaded pipeline from {pipeline_path}")
import joblib
try:
self.pipeline = joblib.load(pipeline_path)
log_and_print(f"Pipeline loaded from {pipeline_path}")
except Exception as e:
log_and_print(f"Failed to load pipeline: {e}", is_error=True)
self.pipeline = None
def ml_signal_generation(self, symbol, n_bars, timeframe):
"""