get_cagr

Portfolio.get_cagr(period=None, real=False)

Calculate the expanding portfolio Compound Annual Growth Rate (CAGR) time series.

The expanding CAGR at each month is the annualized rate of return required for the investment to grow from its initial value to its value at that month, assuming all incomes were reinvested. The last row contains the CAGR over the full selected period.

Inflation adjusted annualized returns (real CAGR) are shown with real=True option. Annualized inflation is calculated for the same period if inflation=True in the Portfolio.

Parameters:
periodint, default None

CAGR trailing period in years. If None, use the full available period.

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 expanding portfolio CAGR and annualized inflation (if inflation=True in Portfolio and real=False).

Notes

CAGR is not defined for periods less than 1 year. The first 11 rows are filled with NaN values.

Examples

>>> pf = ok.Portfolio(["SPY.US", "BND.US"], weights=[0.6, 0.4], ccy="USD", inflation=True)
>>> pf.get_cagr(period=5).tail()

The last row contains the CAGR values over the full selected period.

To get inflation adjusted annualized return (real CAGR) add real=True option:

>>> pf.get_cagr(period=5, real=True).tail()