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

Hi all,

I was playing with futures data on the research enviroment when I found out some inconsistencies regarding the quality of the data. When I use the "history" function to retrieve the data, I saw that prices changed on the same dates when I changed the end_date value in the history function, keeping the same start date. How is this possible? I do not know whether this a bug or I am retrivieng the data incorrectly. Attached in this post you will find a notebook where this inconsistencies are pointed out.

Thanks in advance!

Axel

4 responses

Hi Axel,
It is a very good question. I think it is neither a bug or incorrect data retrieving. The point here is the idea of “Continuous” Futures.

As we know futures contracts on a specific underlying asset can have different expiring dates, and they are all trading in the markets with different prices. Technically, at any time when a future contract expires in 3 months will have different prices from a future contract that expires in 6 months, in 9 months, in 12 months, etc. If we reference the one with the closest expiring date as the future’s price, at the date it expries, there would be two prices. one for the expiring contract, the other is the one expires at the next expiring date. Their prices are mostly likely different, so we see the price jumps at each expiring date.

The reason is straightforward. Recall the futures’ pricing model F(t,T) = S(t)*(1+r) ^(T-t) https://en.wikipedia.org/wiki/Futures_contract. Here F(t,T) is the future price at time t expires at time T. S(t) is the current underlying price, and r is risk free interest rate. Therefore, we can conclude that for the futures with the same underlying assets one who expires later has a higher price from the academic research purpose. (However, in the reality the one with closet expiration date usually have largest trading volume).

The Quantopian also has a lesson talking about continuous futures and how to set up the parameters(Adjustment styles, roll styles and offset)(https://www.quantopian.com/tutorials/futures-getting-started#lesson4 ) and they have a clear graph to prove the above idea.

Therefore, the continuous futures are artificial data or statistical data, which are made by researchers. Many different formulas (or referencing rules) were used to create a continuous future to represent the future contracts price at each moment. The methods are unfortunately not standard in the financial industry.
Now back to your question. The Quantopian uses a parameter adjustment to override the problem of price jumps between contracts. You have adjustment = ‘mul’ for the SPY_cf, which means continuous future was calculated by “multiplying prices series by the ratio of consecutive contract prices”. (from the same article, Quantopian’s continuous future lesson https://www.quantopian.com/tutorials/futures-getting-started#lesson4 ). So, when you use different end_dates to retrieve data, it means the calculation would include more consecutive contracts, therefore prices changed.

I tried to set the end = ‘2012-12-18’ the prices changed, again. Or if you set adjustment = None, the prices won’t change anymore for the changes on end_dates. Because the above article said None means “no adjustments will be applied to the lookback window”.

If you were still confusing, definitely read the Quantopian’s continuous future lesson as I posted the link above.

Hi Abe,

Thank you so much, I was completely wrong with my idea and did not take into account the adjustment types of the continous futures contracts. It's crystal clear right now, thank you so much again. Just two point out, i have one appreciation on your comments:

1)" Therefore, we can conclude that for the futures with the same underlying assets one who expires later has a higher price from the academic research purpose." -> this only holds true for contango regime, or in other words, positive cost of carry. For backwardation regime, therefore a negative cost of carry,
longer maturity contracts will have LOWER prices.

Thank you so much for your comments!

Best regards,

Axel

Hi Axel,
You are right! It only holds true for contango regime. Thank you so much for pointing it out.
Best,
Abe