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.
- realbool, 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_cagrCalculate rolling CAGR.
get_cagrCalculate CAGR.
get_cumulative_returnCalculate cumulative return.
annual_returnCalculate 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()