okama.Portfolio.get_rolling_cagr

Portfolio.get_rolling_cagr(window=12, real=False)

Calculate rolling CAGR (Compound Annual Growth Rate) for the portfolio.

Parameters:
windowint, default 12

Size of the moving window in months. Window size should be at least 12 months for CAGR.

real: bool, default False

CAGR is adjusted for inflation (real CAGR) if True. Portfolio should be initiated with Inflation=True for real CAGR.

Returns:
DataFrame

Time series of rolling CAGR and mean inflation (optionaly).

Notes

CAGR is not defined for periods less than 1 year (NaN values are returned).

Examples

>>> x = ok.Portfolio(['DXET.XFRA', 'DBXN.XFRA'], ccy='EUR', inflation=True)
>>> x.get_rolling_cagr(window=5*12, real=True)
         portfolio_7645.PF
2013-09           0.029914
2013-10           0.052435
2013-11           0.055651
2013-12           0.045180
2014-01           0.063153
                    ...
2021-01           0.032734
2021-02           0.037779
2021-03           0.043811
2021-04           0.043729
2021-05           0.042704