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.
- realbool, 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 (optionally).
Notes
CAGR is not defined for periods less than 1 year (NaN values are returned).
Examples
>>> x = ok.Portfolio(["SPY.US", "BND.US"], ccy="EUR", inflation=True) >>> x.get_rolling_cagr(window=5 * 12, real=True) portfolio_... date ... ...