okama.Portfolio.skewness_rolling
- Portfolio.skewness_rolling(window=60)
Compute rolling skewness of the return time series.
For normally distributed rate of return, the skewness should be about zero. A skewness value greater than zero means that there is more weight in the right tail of the distribution.
- Parameters:
- windowint, default 60
Size of the moving window in months. The window size should be at least 12 months.
- Returns:
- Series
Expanding skewness time series
Examples
>>> pf = ok.Portfolio(['BND.US']) >>> pf.skewness_rolling(window=12*10) Date 2017-04 0.464916 2017-05 0.446095 2017-06 0.441211 2017-07 0.453947 2017-08 0.464805 ... 2021-02 0.007622 2021-03 0.000775 2021-04 0.002308 2021-05 0.022543 2021-06 -0.006534 2021-07 -0.012192 Freq: M, Name: portfolio_8378.PF, dtype: float64
>>> import matplotlib.pyplot as plt >>> pf.skewness_rolling(window=12*10).plot() >>> plt.show()