Back to Community
Quantopian Futures

Any system moving forward from the present moment will trade the current front month, so the systems created will end up transacting at established prices going forward. If you attempt to transact/backtest, do to adjustment the transaction history will be off and the results will be off also. So one could argue you can only realistically forward test a concept/system created and log the transactions.

Regards,
Chris

11 responses

Continous 30 year bond, adjusted data.

http://www.screencast.com/t/nXtvZJViQh

Continous 30 year bond, non adjusted data.

http://www.screencast.com/t/MQs0EGlzC9

Notice if you look at the above pictures, you wont notice a difference, unless you look at the highs, the highs are different as you go further back in history. Thus the prices are actually different, and when you backtest systems results will be different when fed the 2 data sets.

Yearly Performance Summary

Year Days Closed Balance End Total Equity End VADI Total Equity Gain Gain % # Trades

2002 334 121,346.25 121,346.25 121,346.25 8,846.25 7.9% 5
2003 365 128,365.50 128,365.50 128,365.50 7,019.25 5.8% 2
2004 366 139,687.75 139,687.75 139,687.75 11,322.25 8.8% 6
2005 365 139,687.75 139,687.75 139,687.75 0.00 0.0% 0
2006 365 139,687.75 139,687.75 139,687.75 0.00 0.0% 0
2007 365 139,687.75 139,687.75 139,687.75 0.00 0.0% 0
2008 366 139,687.75 139,687.75 139,687.75 0.00 0.0% 0
2009 365 139,687.75 139,687.75 139,687.75 0.00 0.0% 0
2010 365 139,687.75 139,687.75 139,687.75 0.00 0.0% 0
2011 365 139,687.75 139,687.75 139,687.75 0.00 0.0% 0
2012 366 139,687.75 139,687.75 139,687.75 0.00 0.0% 0
2013 365 139,687.75 139,687.75 139,687.75 0.00 0.0% 0
2014 365 139,687.75 139,687.75 139,687.75 0.00 0.0% 0
2015 365 139,687.75 139,687.75 139,687.75 0.00 0.0% 0
2016 366 139,687.75 139,687.75 139,687.75 0.00 0.0% 0
2017 97 139,687.75 139,687.75 139,687.75 0.00 0.0% 0

non adjusted data, 30 year bond.

Yearly Performance Summary

Year Days Closed Balance End Total Equity End VADI Total Equity Gain Gain % # Trades

2002 334 128,549.75 128,549.75 128,549.75 16,049.75 14.3% 5
2003 365 128,549.75 128,549.75 128,549.75 0.00 0.0% 0
2004 366 128,549.75 128,549.75 128,549.75 0.00 0.0% 0
2005 365 128,549.75 128,549.75 128,549.75 0.00 0.0% 0
2006 365 128,549.75 128,549.75 128,549.75 0.00 0.0% 0
2007 365 128,549.75 128,549.75 128,549.75 0.00 0.0% 0
2008 366 128,549.75 128,549.75 128,549.75 0.00 0.0% 0
2009 365 128,549.75 128,549.75 128,549.75 0.00 0.0% 0
2010 365 128,549.75 128,549.75 128,549.75 0.00 0.0% 0
2011 365 128,549.75 128,549.75 128,549.75 0.00 0.0% 0
2012 366 128,549.75 128,549.75 128,549.75 0.00 0.0% 0
2013 365 128,549.75 128,549.75 128,549.75 0.00 0.0% 0
2014 365 128,549.75 128,549.75 128,549.75 0.00 0.0% 0
2015 365 128,549.75 128,549.75 128,549.75 0.00 0.0% 0
2016 366 128,549.75 128,549.75 128,549.75 0.00 0.0% 0
2017 97 128,549.75 128,549.75 128,549.75 0.00 0.0% 0

adjusted data, 30 year bond.

Both sets of data, run through same system.

Most data sets come in:

linked adjusted
linked nonadjusted
specific futures contract (ie March 2007 30 Year Bond)

When creating systems, I've had to just test on individual contracts to make it as realistic as possible, so the data set is only for that specific month/year futures contract. Thus most systems end up closing out as expiration approaches. And resuming system based on the number of bars needed for that system for the new front month futures contract. For signal generation, a certain number of bars are needed to trigger logic of algo.

Hi Krishna,

You're right. An accurate simulation of a futures algo can not be made with just continuous futures nor just contracts - you need both.

The Quantopian Futures API has both continuous futures as well as individual contracts. The continuous futures can be used to get a historical window of data, without lookahead bias, and can be adjusted to account for gaps between contracts. Of course, continuous futures are not tradable assets as you mentioned, they are simply tools that make it possible to perform computations over historical data. When we launch futures in backtesting, algorithms will be able to use continuous futures to get a reference to the current 'active' contract, and can only place trades in contracts themselves. You will be able to maintain a reference to a given underlying asset (e.g. S&P500 e-mini), but will have to get the current contract (or a back contract, if you prefer) to actually trade.

I encourage you to have a look at this notebook introducing our Futures API. Some of the plots using continuous futures may make what I'm saying more clear.

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.

thankyou Jamie, will look through notebook.

Its almost like treating each individual futures contract as a separate security, and use the continuous contract only if its continuous pricing is used in signal logic. Some systems depend on the actual prices and are sensitive even if there is minor price difference secondary to adjustment.

Exit or rollover from one contract to the next will be needed.

Hi Krishna,

Yes, algorithms will be able to reference either contracts or continuous futures, so you can get pricing data for either.

To roll from one contract to the next, you will be able to order the current active contract after getting it from a continuous future, and you will be able to close out contracts that you hold by getting them from context.portfolio.positions. When futures become available in backtesting, this will be demonstrated in sample algorithms, tutorials, and lectures.

For the roll feature, 'days before expiration' feature would be ideal, if one can set the days before expiration, would get the most out of each contracts quantity of price bars.