This is not a new technique, I first posted this technique in February 2015. However, since then, there's been post after post about how getting it through pipeline has issues, fetch_csv doesn't work in live trading, or it has lookahead bias in backtests.
Attached is the technique I used in my algos which I live-traded for over a year (but recently stopped for compliance reasons). It should be easily adaptable to other time series that you want to have the time-series of inside your scheduled functions or callbacks, so you don't have to jam all the business logic into a single pipeline custom factor.
Although this example is only getting the last day of vix_vals
via [-1]
, there are History
days prior, so you can easily do pandas time-series transformations on the data to get moving averages, standard deviations, etc...
Note that algos which use this are not eligible for the contest, or the fund, or anything, but for personal trading, it worked fine for me for months, notwithstanding bugs, restarts, disconnections and Q2.
Good luck,
Simon.