quantlab.backtest.live.predict_live_bar#
- quantlab.backtest.live.predict_live_bar(run_dir, store, *, mirrors=(), may_lag=())[source]#
Extend a run’s stores to the price dataset’s last bar t and append t’s prediction.
See the module docstring for which stores are extended, what is refused and when a row is exact.
- Parameters:
- run_dirstr or os.PathLike
A backtest
run()directory with a model (the strategy’s recipe).- storestr or os.PathLike
The live prediction store (
LivePredictionStore); created by the first call.- mirrorsiterable of str or os.PathLike
Stores of leaf datasets of the run that copy variables of its price dataset (
mirror_new_bars).- may_lagiterable of str or os.PathLike
Stores of leaf datasets of the run allowed to end before t.
- Returns:
- LivePrediction
- Raises:
- LivePredictionRefused
When nothing is appended (see the module docstring).
Examples
After
scripts/sharadar/update.pyhas appended 2026-10-07:>>> done = predict_live_bar( ... run_dir, "/data/quantlab/live/sp500_xgb_mvo/live_predictions.zarr", ... may_lag=["/data/quantlab/market/fred/fred_dtb3_1d/fred_dtb3_1d.zarr"], ... ) >>> done.timestamp Timestamp('2026-10-07 00:00:00') >>> predict_live_bar(run_dir, "/data/quantlab/live/sp500_xgb_mvo/live_predictions.zarr") Traceback (most recent call last): LivePredictionRefused: 2026-10-07 is already predicted in ...