percentile_cagr

Portfolio.percentile_cagr(years, percentiles=[10, 50, 90])

Calculate given percentiles for portfolio rolling CAGR distribution from the historical data.

CAGR - Compound Annual Growth Rate. Each percentile is calculated for a period range from 1 year to ‘years’.

Parameters:
yearsint

Max window size for rolling CAGR in the distribution in years. It should not exceed 1/2 of the portfolio history period length ‘period_length’.

percentileslist of int, default [10, 50, 90]

List of percentiles to be calculated.

Returns:
DataFrame

Table with percentiles values for each period from 1 to ‘years’.

Examples

>>> pf = ok.Portfolio(
...     ["SPY.US", "AGG.US", "GLD.US"],
...     weights=[0.60, 0.35, 0.05],
...     rebalancing_strategy=ok.Rebalance(period="none"),
... )
>>> pf.percentile_cagr(years=5, percentiles=[1, 50, 99])
             1         50        99
years
1     -0.231327  0.098693  0.295343
2     -0.101689  0.091824  0.206471
3     -0.036771  0.085428  0.157833
4     -0.007674  0.085178  0.142195
5      0.030933  0.082865  0.134496