numeraire.core.protocols.SupportsWeights#

class numeraire.core.protocols.SupportsWeights(*args, **kwargs)[source]#

Bases: Protocol

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

Optional and dispatched by capability — a model advertises it via capabilities() >= {capabilities.TO_WEIGHTS}. Kept deliberately thin; the capability layer crystallizes once the third real adapter lands.

__init__(*args, **kwargs)#

Methods

__init__(*args, **kwargs)

to_weights(view)

Return per-date weights for each date in view.calendar.

to_weights(view: DataView) DataFrame | Series[source]#

Return per-date weights for each date in view.calendar.

A fixed-universe time-series method returns a wide (date x asset) pd.DataFrame; a cross-sectional (ragged / entering-exiting universe) method returns a long pd.Series on a (date, asset) MultiIndex — the panel engine (backtest_panel) accepts that form (or an equivalent one-column frame). Either way the engine aligns the returned labels to realized returns before scoring, so column / row order need not be canonical.