zipline icon indicating copy to clipboard operation
zipline copied to clipboard

Example using futures

Open npezolano opened this issue 11 years ago • 24 comments

Is there an example using futures + zipline?

I have my own futures data.

npezolano avatar Jun 15 '15 03:06 npezolano

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.

warren-oneill avatar Jun 15 '15 07:06 warren-oneill

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?

twiecki avatar Jun 15 '15 10:06 twiecki

+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

kenhersey avatar Jun 23 '15 02:06 kenhersey

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.

jfkirk avatar Jun 23 '15 19:06 jfkirk

@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 avatar Jun 23 '15 20:06 npezolano

@npezolano Thanks for the data link! That is very helpful.

jfkirk avatar Jun 23 '15 20:06 jfkirk

@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. :)

kenhersey avatar Jun 24 '15 11:06 kenhersey

@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 avatar Aug 06 '15 06:08 cmorgan

@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.

jfkirk avatar Aug 06 '15 17:08 jfkirk

I'm really looking forward to using zipline/quantopian with futures. Thanks for your work on this.

ghost avatar Oct 07 '15 01:10 ghost

Any update on this ?

martingaleakki avatar May 09 '16 19:05 martingaleakki

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.

freddiev4 avatar May 04 '17 20:05 freddiev4

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?

moonlight16 avatar Jul 09 '17 19:07 moonlight16

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.

moonlight16 avatar Aug 08 '17 09:08 moonlight16

Same issue here. Still looking for good examples on how to use futures data with zipline for backtesting.

pauljherrera avatar Sep 28 '17 23:09 pauljherrera

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.

sample_futures_quandl.pdf

moonlight16 avatar Sep 28 '17 23:09 moonlight16

@jacohn16 I've been working on how to ingest futuress data into zipline. Thanks for your link. What kind of errors are you seeing?

JoaoAparicio avatar Oct 04 '17 21:10 JoaoAparicio

@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?

JoaoAparicio avatar Oct 04 '17 21:10 JoaoAparicio

@jacohn16 Also, running it I get AttributeError: 'zipline.assets._assets.Future' object has no attribute 'roll_style'

JoaoAparicio avatar Oct 05 '17 09:10 JoaoAparicio

@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?

pauljherrera avatar Oct 06 '17 00:10 pauljherrera