API reference#

The API is organised in three layers: the top-level numeraire namespace (the common surface, re-exported for convenience), the numeraire.core spine, and the core-adjacent infrastructure (testing, reference, comparison, baselines, adapters).

Top-level namespace#

The most common classes and functions are re-exported at the top level, so from numeraire import TimeSeriesView, backtest, SharpeEvaluator works directly.

TimeSeriesView

A point-in-time view: a returns (decision) calendar + one or more aligned feature blocks.

CrossSectionView

A cross-sectional (panel) view: many assets with per-asset characteristics, ragged over time.

WalkForwardSplitter

Expanding- or rolling-window walk-forward splitter.

validation_split

Split a (train) view into PIT (fit, valid): valid = the last valid_size dates.

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.

SharpeEvaluator

Annualized Sharpe ratio of the realized strategy returns (the timing headline).

MeanReturnEvaluator

Annualized mean of the realized strategy returns.

CEQEvaluator

DGU (2009) certainty-equivalent return of the realized strategy returns (economic value).

AlphaEvaluator

Time-series alpha of the strategy vs a factor benchmark (HAC t-stat).

StrategyReturnEvaluator

Per-period (time-indexed) realized strategy return — one result row per date.

OutOfSampleR2Evaluator

Out-of-sample R^2 of a forecast vs a benchmark, 1 - SSE_model / SSE_benchmark (percent).

SquaredErrorDiffEvaluator

Per-origin squared-error difference (benchmark minus model), one row per date.

ClarkWestEvaluator

Clark-West (2007) MSPE-adjusted test of the forecast against its nested benchmark.

CrossSectionalR2Evaluator

Cross-sectional R^2 of mean realized returns on mean predicted expected returns (OLS).

AverageAbsAlphaEvaluator

Average absolute pricing error (mean over assets of |mean realized - mean predicted|).

DataView

A point-in-time aligned view of the data.

Estimator

scikit-learn-compatible.

Model

A fitted model.

Splitter

Yields (train, test) views — purge/embargo/PIT aware.

Evaluator

Scores OOS output, emitting rows of the standard tidy result schema.

SupportsWeights

Capability protocol (v0): a model that emits portfolio/timing weights (to_weights).

SupportsForecast

Capability protocol (v0): a model that emits a next-horizon return forecast.

SupportsPricing

Capability protocol: a model that prices a cross-section of test assets (to_pricing).

validate_result

Raise ValueError if df is missing any required result-schema column.

register_evaluator

Register evaluator under name.

get_evaluator

Return the evaluator registered under name.

available_evaluators

Return the names of all registered evaluators, sorted.

simulate_weights

Simulate a target-weight stream over data-frequency returns (conventions in module doc).

RebalanceSchedule

Decision (signal) dates mapped to the half-open data-row spans they govern.

SimulationResult

Realized simulation output plus the accounting provenance every result row needs.

sort_portfolios

Cross-sectional n_bins sort of signal with per-period weighted portfolio returns.

SortResult

Per-period sorted-portfolio returns plus the long-short spread.

grs_test

Gibbons-Ross-Shanken (1989) test that all time-series alphas are jointly zero.

sharpe_diff_test

Jobson-Korkie (1981) z-test of equal Sharpe ratios with the Memmel (2003) correction.

clark_west_test

Clark-West (2007) MSPE-adjusted test for nested models.

alpha_regression

OLS of portfolio (excess) returns on factor returns; HAC (Bartlett) coefficient errors.

adjust_pvalues

Multiple-testing adjustment for a family of tests (Harvey-Liu-Zhu 2016 §4.4 toolbox).

newey_west_lrv

Bartlett-kernel long-run variance of a 1-D series (lags=0 = plain variance, MLE).

certainty_equivalent

DGU (2009) eq.

return_loss

DGU (2009) eq.

performance_fee

Quadratic-utility performance fee (Fleming-Kirby-Ostdiek; Kirby-Ostdiek 2012 eq.