Answers for "rolling half life mean reversion"

5

uninstall nginx

sudo apt-get purge nginx nginx-common
Posted by: Guest on November-14-2020
1

remove nginx

sudo apt-get remove nginx* --purge
Posted by: Guest on November-29-2020
0

rolling half life mean reversion

z_lag = np.roll(z_array,1)
z_lag[0] = 0
z_ret = z_array - z_lag
z_ret[0] = 0

#adds intercept terms to X variable for regression
z_lag2 = sm.add_constant(z_lag)

model = sm.OLS(z_ret,z_lag2)
res = model.fit()

halflife = -log(2) / res.params[1]
Posted by: Guest on October-23-2021

Browse Popular Code Answers by Language