Messing around with etfs and have this issue below.
Calculate trailing WVIX, when current crosses trailing X day max, buy. If worthy, to be used as technical indicator as part of a factor combination.
Most efficient way to calculate it given that cannot reference earlier values of factors in the pipeline as an input -- i.e. DataSets are just collections of objects and do not hold actual data
1) Use data.history --> pipeline preferred
2) a custom factor for each day up to X with varying window lengths --> messy, lots of line of pointless code, increase change of manual error, parameter changes more tedious
- being done below in class WVIX for today, and class WVIXHIST for history with each day set up in initialize
3) Use Global Context Variable (GCV) in conjunction with custom factor then do analysis on the GCV (e.g. https://www.quantopian.com/posts/obv-custom-factor) - doing this
ISSUE: looks like GCV df populated throughout testing period at inception so when pulling data from there, dates are off - after time stamp, log shows on Nov 13/09, that the gcv last 10 slice has data all the way out to May 13, 2010. Did I do timestamping wrong (..just used today in custom factor) ... is this meant to be this way be design?
Also is there a way to run the custom factor without adding it to pipeline? I do not want the custom factor output per-say, but need to run it for the GCV - more of a resource/memory management question.
Log generated from code on line 327:
2009-11-13 10:31 order_positions:317 INFO assets wvix_again timestamp
38292 14.432192 2010-04-28 00:00:00+00:00
38292 13.088930 2010-04-29 00:00:00+00:00
38292 12.630674 2010-04-30 00:00:00+00:00
38292 15.437491 2010-05-03 00:00:00+00:00
38292 15.194043 2010-05-04 00:00:00+00:00
38292 20.048690 2010-05-05 00:00:00+00:00
38292 23.468507 2010-05-06 00:00:00+00:00
38292 29.725037 2010-05-07 00:00:00+00:00
38292 28.961667 2010-05-10 00:00:00+00:00
38292 18.070652 2010-05-11 00:00:00+00:00
38292 17.879891 2010-05-12 00:00:00+00:00
38292 15.923567 2010-05-13 00:00:00+00:00