Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Futures template

Hi, any idea or update when we will have futures template to play around with. In my opinion this is biggest blocker to get started on futures algos. Having a piece of standardized Quantopian code that we can modify and switch the algorithm/parameters to our own criteria is the difference between day/night on coding future algos.

Thanks,
Leo

5 responses

Hi Leo,

Have you checked out the two sample futures algorithms available in our documentation page? You can find them here. You can also find a simple calendar-spread algorithm in this community post.

I hope 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.

Thanks Ernesto! Very helpful information.

Hi Ernesto,

I am getting the following error when I clone and run the first algorithm in this section "https://www.quantopian.com/help#sample-futures". Futures Trend Follow. This algorithm is a very simple example of a trend follow example that trades 9 different futures. It is an adaptation of the simple example used by Andreas Clenow in his book Following the Trend.

Backtest Error:

Something went wrong. Sorry for the inconvenience. Try using the built-in debugger to analyze your code. If you would like help, send us an email.
NoDataAfterDate: No data on or after day=2015-08-21 00:00:00+00:00 for sid=1034201506
There was a runtime error on line 63.

Backtest period: 2015-07-01 to 2017-07-01 with $10,000,000 initial capital.

I have tried several different periods as well as removing the selection of futures under consideration. I keep hitting the same error a month or two after the start period in line #63 (code below).

hist = data.history(context.my_futures, 'price', 100, '1d')

It appears the continuous futures is not working as expected since some future went beyond its close date?

Could you suggest what I need to change in the algo to get past this error.

Hi Ernesto, no need to follow up on this error. Looks like this issue is already known to Quantopian ( I saw it in another post just recently), there is an update that it is being investigated.

Regards,
Leo

Hi Leo, we just pushed a fix that should solve this problem for 68/72 futures. The problem may still occur with MG, BD, EI, and MD in certain situations. We should have a follow-up fix for these names in the next couple of days.

Sorry for the trouble.

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.