Example using futures
Is there an example using futures + zipline?
I have my own futures data.
Hey Nicholas you can find an example here in the unittests. Does that help? In this case the price data is passed to the algo using a pandas panel and the metadata as a dict.
It would be great if we could get a NB showing how to use futures on a freely obtainable data set. That could easily be integrated into the existing documentation. @jfkirk thoughts?
+1 Thomas. There were some examples in the folder before the futures merge, but I suspect they were dependent upon James's data ingest. Perhaps something based upon a quandl data set would be more universally explanatory to others - such as data from https://www.quandl.com/data/CHRIS/CME_ES1
Adding an example futures algo is on my docket. We're currently adding a few more convenience methods (contract lookup in the chain, rolling, etc) and I'd like to have them in the example. Once those are in, I will generate an example algo and hunt down some freely obtainable data.
Self-assigning.
@kenhersey Unfortunately you need the actual contracts and not a continuous price.
If any one needs, you can get VIX futures data provided free by the CBOE here: http://cfe.cboe.com/products/historicalvix.aspx
@npezolano Thanks for the data link! That is very helpful.
@npezolano et al, even better for an example that handles actual contracts vs. continuous. These are also available at quandl.com:
These pages have the info: https://www.quandl.com/data/CME/ESU2015 https://www.quandl.com/data/CME/ESM2015 etc.
And, here's how you format for the data retrieval: https://www.quandl.com/api/v1/datasets/CME/ESU2015.csv https://www.quandl.com/api/v1/datasets/CME/ESM2015.csv etc. just keep changing the month code and year
HTH. And, glad to hear, James, it's on the list. :)
@jfkirk is there a rough cut of the futures algo. laying around in branch anywhere? even incomplete i'm sure it would be instructive of the API. thanks
@cmorgan Not yet, sadly -- we are still hammering out details of how we want the API to look but, once we have that settled, we'll be writing some examples.
I'm really looking forward to using zipline/quantopian with futures. Thanks for your work on this.
Any update on this ?
Hi @npezolano @martingaleakki. Futures are available now although we don't yet have any example algorithms in the zipline repo (some can be found in the forums and one in the tutorials).
In regards to futures data, I don't think the quantopian-quandl bundle contains futures data so there would need to be some way to bundle futures data that can be ingested for a futures algorithm.
I'm looking to ingest Futures data (minute bars) from quantopian - just like you would get when running backtests using quantopian.com. Is this possible yet?
It seems this issue has been up since 2015. Any progress with this?
It would be nice to have some good examples for using zipline + futures data.
Same issue here. Still looking for good examples on how to use futures data with zipline for backtesting.
Here's what I eventually got working. But my issue with zipline is that it doesn't seem to be stable and is tedious to debug. New errors pop up from time to time, and its becoming obvious to me that its not working "out of the box". Particularly it has weak support for Futures; not to mention you have to supply your own data.
@jacohn16 I've been working on how to ingest futuress data into zipline. Thanks for your link. What kind of errors are you seeing?
@jacohn16 I can't get zipline run to run your code. I get zipline.errors.SidsNotFound: No asset found for sid: 55555. It also seems that the if __name__ == "__main__": bit of the code is completely ignored. What am I missing?
@jacohn16 Also, running it I get AttributeError: 'zipline.assets._assets.Future' object has no attribute 'roll_style'
@jacohn16 I am also getting the zipline.errors.SidsNotFound: No asset found for sid: 55555 error. Even when you are using quandl in that script, you still need to ingest data previously?