okama.AssetList.get_rolling_cagr

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

Calculate rolling CAGR for each asset.

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.

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

Returns:
DataFrame

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

See also

get_rolling_cagr

Calculate rolling CAGR.

get_cagr

Calculate CAGR.

get_rolling_cumulative_return

Calculate rolling cumulative return.

annual_return

Calculate annualized mean return (arithmetic mean).

Notes

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

Examples

>>> import matplotlib.pyplot as plt
>>> x = ok.AssetList(['SPY.US', 'AGG.US'], ccy='USD', inflation=True)
>>> x.get_rolling_cagr(window=5*12).plot()
>>> plt.show()
../_images/okama-AssetList-get_rolling_cagr-1_00_00.png

For inflation adjusted rolling CAGR add ‘real=True’ option:

>>> x.get_rolling_cagr(window=5*12, real=True).plot()
>>> plt.show()
../_images/okama-AssetList-get_rolling_cagr-1_01_00.png