okama.AssetList.tracking_error

AssetList.tracking_error(rolling_window=None)

Calculate tracking error time series for the rate of return of assets.

Tracking error is defined as the standard deviation of the difference between the returns of the asset and the returns of the benchmark. Tracking error is measured in percents.

Benchmark should be in the first position of the symbols list in AssetList parameters.

Parameters:
rolling_windowint or None, default None

Size of the moving window in months. Must be at least 12 months. If None calculate expanding tracking error.

Returns:
DataFrame

rolling or expanding tracking error time series for each asset.

Examples

>>> import matplotlib.pyplot as plt
>>> x = ok.AssetList(['SP500TR.INDX', 'SPY.US', 'VOO.US'], last_date='2021-01')
>>> x.tracking_error().plot()
>>> plt.show()
../_images/okama-AssetList-tracking_error-1_00_00.png

To calculate rolling tracking error set rolling_window to a number of months (moving window size):

>>> x.tracking_error(rolling_window = 12*5).plot()
>>> plt.show()
../_images/okama-AssetList-tracking_error-1_01_00.png