okama.AssetList.get_cagr

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

Calculate assets 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. AssetList should be initiated with Inflation=True for real CAGR.

Returns:
Series

CAGR values for each asset and annualized inflation (optional).

See also

get_rolling_cagr

Calculate rolling CAGR.

Notes

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

Examples

>>> x = ok.AssetList()
>>> x.get_cagr(period=5)
SPY.US    0.1510
USD.INFL   0.0195
dtype: float64

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

>>> x = ok.AssetList(['EURUSD.FX', 'CNYUSD.FX'], inflation=True)
>>> x.get_cagr(period=5, real=True)
EURUSD.FX    0.000439
CNYUSD.FX   -0.017922
dtype: float64