okama.Portfolio.get_cagr

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

Calculate portfolio Compound Annual Growth Rate (CAGR) for a given trailing period.

Compound annual growth rate (CAGR) is the rate of return that would be required for an investment to grow from its initial to its final value, assuming all incomes were reinvested.

Inflation adjusted annualized returns (real CAGR) are shown with real=True option.

Annual inflation value is calculated for the same period if inflation=True in the AssetList.

Parameters:
period: int, optional

CAGR trailing period in years. None for the full time 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:
Series

Portfolio CAGR value and annualized inflation (optional).

Notes

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

Examples

>>> pf = ok.Portfolio(['XCS6.XETR', 'PHAU.LSE'], weights=[0.85, 0.15], ccy='USD')
>>> pf.names
{'XCS6.XETR': 'Xtrackers MSCI China UCITS ETF 1C', 'PHAU.LSE': 'WisdomTree Physical Gold'}

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

>>> pf.get_cagr(period=5, real=True)
portfolio_5625.PF    0.121265
dtype: float64