okama.Portfolio.percentile_history_cagr
- Portfolio.percentile_history_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:
- years: int, default 1
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’.
- percentiles: list 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=[.60, .35, .05], rebalancing_period='none') >>> pf.percentile_history_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