quantlab.model.predefined.recorded#

Serve a recorded backtest run’s predictions instead of predicting them again.

A backtest run with a model writes the predictions its rule read (predictions.zarr, a PredictionPanel). Those predictions depend only on the checkpoint and on the data up to each bar, not on where the backtest started, so a run that only moves the window over the same checkpoints, a run_cv started from cash on another bar for example, can read them back instead of computing every feature and running every model again.

With history=True the record also serves the bars before the loaded checkpoint’s window, as the earlier folds’ checkpoints predicted them: the history a wrapper that reads past predictions (SmoothedPredictor) needs at a fold’s first bars, each value made at its own bar by the checkpoint live then, so nothing is known before its bar.

RecordedPredictor wraps the predictor that made them and answers predict_window from the record. Everything else forwards to the wrapped predictor, load included, so the backtester checks and loads each checkpoint as before; the wrapper only serves the predictions that the loaded checkpoint made in the recorded run.

Classes

RecordedPredictor

A Predictor that serves a recorded backtest run's predictions.

RecordedPredictorConfig

What a RecordedPredictor is rebuilt from.