Annualized Returns against Benchmark

perfana.monte_carlo.returns.annualized_bmk_returns_m(data, weights, bmk_weights, freq, geometric=True, rebalance=True)[source]

Calculates the returns of the portfolio relative to a benchmark portfolio.

The benchmark components must be placed after the portfolio components in the simulated returns cube.

Parameters
  • data (ndarray) – Monte carlo simulation data. This must be 3 dimensional with the axis representing time, trial and asset respectively.

  • weights (Union[Iterable[Union[int, float]], ndarray, Series]) – Weights of the portfolio. This must be 1 dimensional and must match the dimension of the data’s last axis.

  • bmk_weights (Union[Iterable[Union[int, float]], ndarray, Series]) – Weights of the benchmark portfolio.

  • freq (Union[str, int]) – Frequency of the data. Can either be a string (‘week’, ‘month’, ‘quarter’, ‘semi-annual’, ‘year’) or an integer specifying the number of units per year. Week: 52, Month: 12, Quarter: 4, Semi-annual: 6, Year: 1.

  • geometric (bool) – If True, calculates the geometric mean, otherwise, calculates the arithmetic mean.

  • rebalance (bool) – If True, portfolio is assumed to be rebalanced at every step.

Returns

The portfolio returns relative to the benchmark

Return type

float

Examples

>>> from perfana.datasets import load_cube
>>> from perfana.monte_carlo import annualized_bmk_returns_m
>>> cube = load_cube()
>>> weights = [0.25, 0.18, 0.13, 0.11, 0.24, 0.05, 0.04]
>>> bmk_weights = [0.65, 0.35]
>>> freq = "quarterly"
>>> annualized_bmk_returns_m(cube, weights, bmk_weights, freq)
-0.006819613944426206