okama.AssetList.get_rolling_cumulative_return
- AssetList.get_rolling_cumulative_return(window=12, real=False)
Calculate rolling cumulative return for each asset.
The cumulative return is the total change in the asset price.
- Parameters:
- windowint, default 12
Size of the moving window in months.
- real: bool, default False
Cumulative return is adjusted for inflation (real cumulative return) if True. AssetList should be initiated with Inflation=True for real cumulative return.
- Returns:
- DataFrame
Time series of rolling cumulative return.
See also
get_rolling_cagr
Calculate rolling CAGR.
get_cagr
Calculate CAGR.
get_cumulative_return
Calculate cumulative return.
annual_return
Calculate annualized mean return (arithmetic mean).
Examples
>>> import matplotlib.pyplot as plt >>> x = ok.AssetList(['SPY.US', 'AGG.US'], ccy='USD', inflation=True) >>> x.get_rolling_cumulative_return(window=5*12).plot() >>> plt.show()
For inflation adjusted rolling cumulative return add ‘real=True’ option:
>>> x.get_rolling_cumulative_return(window=5*12, real=True).plot() >>> plt.show()