numeraire.core.engine#

Walk-forward OOS engine. The most-reused, most-bug-prone, method-agnostic core.

The driver is deliberately small: for each (train, test) fold it fits the estimator on the train view and asks the fitted model for its capability output on the test view, then computes realized P&L from the original full view so the model never touches future returns. Output is one tidy container carrying the preprocessing/vintage provenance every result row needs (config_hash + data_vintage).

Naming convention: *Output classes (WeightsOutput, ForecastOutput, PricingOutput, PanelWeightsOutput) are the engine’s capability artifacts — the OOS panels an Evaluator consumes to produce result rows. *Result classes elsewhere (SimulationResult, SortResult, the stats *Result records) are the return values of one-shot computations. If it feeds an evaluator it is an Output; if it is a computed answer it is a Result.

backtest

Backtest estimator over view, dispatching to the right typed driver by capability.

backtest_weights

Run a walk-forward OOS backtest of a to_weights estimator over view.

backtest_panel

Walk-forward OOS backtest of a cross-sectional to_weights estimator over a ragged panel.

backtest_forecast

Walk-forward pseudo-OOS forecast (forecast-origin convention; GW2008 / 1-A / VoC).

backtest_pricing

Walk-forward OOS pricing of a to_pricing estimator: pooled predicted vs realized panels.

backtest_pricing_in_sample

In-sample pricing: one full-sample fit, expected returns over the whole view (in_sample).

config_hash

Stable short hash of a JSON-serializable config dict (preprocessing provenance).

WeightsOutput

OOS output for a to_weights method: realized weights aligned with realized returns.

PanelWeightsOutput

OOS output for a cross-sectional to_weights method over a ragged panel.

ForecastOutput

OOS output for a to_forecast method: per-origin forecast, realized return, benchmark.

PricingOutput

Output for a to_pricing method: predicted expected returns vs realized, on test assets.