Diversification Ratio

perfana.monte_carlo.risk.diversification_m(cov_or_data, weights, freq)[source]

Derives the diversification ratio of the portfolio

Parameters
  • cov_or_data (ndarray) – Covariance matrix or simulated returns data cube.

  • 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.

  • 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.

Returns

Tracking error of the portfolio

Return type

float

Examples

>>> from perfana.datasets import load_cube
>>> from perfana.monte_carlo import portfolio_cov, diversification_m
>>> data = load_cube()[..., :7]  # first 7 asset classes
>>> weights = [0.25, 0.18, 0.13, 0.11, 0.24, 0.05, 0.04]
>>> freq = 'quarterly'
>>> diversification_m(data, weights, freq)