Back to Community
Quantopian/zipline good for futures/cta backtesting?

In many forums I read that Quantopian platform is good mainly for US equities. Has it evolved over time to support Futures trading?
Does it automatically take care of automatic rolling of contracts during expiry? something like this Contrinues Futures or any other similar issues that we deal with futures specifically but not when dealing with equities.

I am looking for alternatives such as PyAlgoTrade and Backtrader if Zipline doesn't provide these options.

6 responses

Hi Alok,

Futures were added to the Quantopian platform about a month ago. Check out the launch post for all the details. There were several futures-specific features that were added to assist with contract rolling. Continuous Futures were added to help you maintain a dynamic reference to a particular chain of contracts. Since there is a wide variety of ways that quants like to roll from one contract to the next, we didn't build in an automatic rolling feature. However, continuous futures can be used to roll according to a logic that you define. I would recommend starting out with the tutorial to learn the new API. The tutorial will show you how to explore the futures data on Quantopian and research an idea. It will also walk you implementing an idea in an algorithm and backtesting it.

Continuous futures and other parts of the API that were built for futures trading are available in Zipline as well.

Let me know if this helps.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

this is great information. I will check this out. doss this mean it is available in zipline as well? i want use a local version with more dev surrounding the platform for my custom risk management etc. i am not sure if this is the right forum to ask about zipline

The API features that I described above are available in Zipline. However, the futures pricing and volume data is only available on Quantopian. You can use Zipline locally if you can supply the data that you need.

In general, it's best to ask Zipline-specific questions in the Zipline repository on Github. Our engineering team monitors the repo so you should get answers to your questions there. Of course, if you have questions like you did about the API, it's definitely appropriate to ask in the Quantopian forums as well.

Hi Alok,

Building on what Jamie said, the features that are available in backtesting are also available in Zipline, excluding pricing and volume data. If you build your own data bundle of futures data, you can run backtests locally. There is more information on writing new data bundles here, which should then allow you to ingest your own futures data. You can see how to get started with Zipline by looking at the README file on GitHub as well!

We also have a mailing list where users of Zipline chat about what they're using zipline for, ask questions, and occasionally we'll make announcements on releases or significant changes to Zipline.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Thank you for all the valuable information!

@Freddie

That link on writing new data bundles is far from enough to actually write one. I've been to the github repo for Zipline as you suggested, but the ticket asking for examples of how to add a futures bundle has been open since 2015.