I used 25-day moving average of vix as my trading signal and I found that the value between Mar 20 2016 and Apr 19 2016 is problematic.
Can someone figure out the reason?
Thanks.
I used 25-day moving average of vix as my trading signal and I found that the value between Mar 20 2016 and Apr 19 2016 is problematic.
Can someone figure out the reason?
Thanks.
I have tested this VixMavg(CustomFactor) on window 2 and nothing was wrong:
class VixMavg(CustomFactor):
inputs=[yahoo_index_vix.close]
window_length=2
def compute(self,today,assets,out,close):
close=close.ravel()
mean_close=pd.Series(close).rolling(window=2).mean()
out[:]=mean_close.iloc[-1]
2016-03-17 05:45 PRINT 15.915
2016-03-18 05:45 PRINT 14.715
2016-03-21 05:45 PRINT 14.23
2016-03-22 05:45 PRINT 13.905
2016-03-23 05:45 PRINT 13.98
2016-03-24 05:45 PRINT 14.555
But starting with window 3 this code generate a bug on Gann's day 2016-03-21
class VixMavg(CustomFactor):
inputs=[yahoo_index_vix.close]
window_length=3
def compute(self,today,assets,out,close):
close=close.ravel()
mean_close=pd.Series(close).rolling(window=3).mean()
out[:]=mean_close.iloc[-1]
2016-03-17 05:45 PRINT 16.25
2016-03-18 05:45 PRINT 15.4233333333
2016-03-21 05:45 PRINT 2342.82
2016-03-22 05:45 PRINT 14.0833333333
2016-03-23 05:45 PRINT 13.9933333333
2016-03-24 05:45 PRINT 14.3
These values calculated on my own data:
16.25
15.42333333
14.48333333
14.08333333
13.99333333
14.3
VIX data is exactly the same as in my own database:
2016-03-17 05:45 PRINT 14.99
2016-03-18 05:45 PRINT 14.44
2016-03-21 05:45 PRINT 14.02
2016-03-22 05:45 PRINT 13.79
2016-03-23 05:45 PRINT 14.17
2016-03-24 05:45 PRINT 14.94
03/16/2016 15.96 16.33 14.89 14.99
03/17/2016 15.34 15.38 13.82 14.44
03/18/2016 14.05 14.36 13.75 14.02
03/21/2016 14.57 14.73 13.79 13.79
03/22/2016 14.57 14.76 13.75 14.17
03/23/2016 14.57 15.03 14.33 14.94
So it is not a data error it is a bug somewhere else.