backtest_lib.portfolio.uniform_portfolio#

backtest_lib.portfolio.uniform_portfolio(full_universe: Iterable[str], tradable_universe: Iterable[str] | None = None, value: float = 1.0, backend: str = 'polars') WeightedPortfolio#

Create an equal-weight portfolio over a universe.

The portfolio distributes weights uniformly across the tradable subset of the universe and assigns zero weight to non-tradable securities.

Parameters:
  • full_universe – Full set of securities used to index holdings.

  • tradable_universe – Optional subset of securities that receive non-zero weight. Defaults to full_universe.

  • value – Total portfolio value to assign.

  • backend – Backend used to construct the holdings mapping.

Returns:

WeightedPortfolio with uniform weights over the tradable securities.