Back to Community
Futures liquid trading period

I am developing an algorithm using futures available here.

However my positions fail to fill because my registered handlers are set at odd times. What is the best period to trade futures when there is most volume? Since Quantopian allows you to set the handlers using time_rules=market_open(hours=xxx) or market_close(hours=xxx), what is the best period?

Could an experienced person advise please?

8 responses

The high volume periods for futures can really vary depending on the particular future you are trading. I've attached a notebook that you can use to plot the volume profiles of each future. You'll notice that certain types/sectors can have narrow volume windows. On the other hand, certain futures like the Japanese Yen that are heavily influenced by international markets might trade more actively outside of US market hours.

Let me know if this helps.

Loading notebook preview...
Notebook previews are currently unavailable.
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 Jamie. It is a very useful notebook.

Hi Jamie,

Any advise? Please see a snippet of logs. It is unable to fill. I have a feeling that Quantopian is mixing up the volume of futures traded and the volume x contract size.

2014-02-04 06:00 WARN Your order for 14 shares of RRH14 has been partially filled. 12 shares were successfully purchased. 2 shares were not filled by the end of day and were canceled.  
2014-02-04 06:00 WARN Your order for 25 shares of ETJ14 failed to fill by the end of day and was canceled.  
2014-02-04 06:00 WARN Your order for -57 shares of LBH14 has been partially filled. 4 shares were successfully sold. 53 shares were not filled by the end of day and were canceled.  
2014-02-04 06:00 WARN Your order for -113 shares of OAH14 has been partially filled. 1 shares were successfully sold. 112 shares were not filled by the end of day and were canceled.  
2014-02-05 06:00 WARN Your order for -106 shares of OAH14 has been partially filled. 3 shares were successfully sold. 103 shares were not filled by the end of day and were canceled.  
2014-02-05 06:00 WARN Your order for -66 shares of LBH14 failed to fill by the end of day and was canceled.  
2014-02-05 06:00 WARN Your order for 31 shares of ETH14 failed to fill by the end of day and was canceled.  
2014-02-06 06:00 WARN Your order for -13 shares of RRH14 has been partially filled. 1 shares were successfully sold. 12 shares were not filled by the end of day and were canceled.  
2014-02-06 06:00 WARN Your order for 86 shares of OAH14 has been partially filled. 5 shares were successfully purchased. 81 shares were not filled by the end of day and were canceled.  
2014-02-06 06:00 WARN Your order for -47 shares of LBH14 has been partially filled. 2 shares were successfully sold. 45 shares were not filled by the end of day and were canceled.  
2014-02-06 06:00 WARN Your order for 45 shares of ETH14 has been partially filled. 1 shares were successfully purchased. 44 shares were not filled by the end of day and were canceled.  
2014-02-07 06:00 WARN Your order for 7 shares of RRH14 has been partially filled. 1 shares were successfully purchased. 6 shares were not filled by the end of day and were canceled.  
2014-02-07 06:00 WARN Your order for -119 shares of OAH14 has been partially filled. 10 shares were successfully sold. 109 shares were not filled by the end of day and were canceled.  
2014-02-07 06:00 WARN Your order for -52 shares of LBH14 failed to fill by the end of day and was canceled.  
2014-02-07 06:00 WARN Your order for 35 shares of ETH14 has been partially filled. 2 shares were successfully purchased. 33 shares were not filled by the end of day and were canceled.  
2014-02-08 06:00 WARN Your order for -13 shares of RRH14 has been partially filled. 2 shares were successfully sold. 11 shares were not filled by the end of day and were canceled.  
2014-02-08 06:00 WARN Your order for 244 shares of OAH14 has been partially filled. 8 shares were successfully purchased. 236 shares were not filled by the end of day and were canceled.  
2014-02-08 06:00 WARN Your order for -21 shares of LBH14 failed to fill by the end of day and was canceled.  
2014-02-08 06:00 WARN Your order for 29 shares of ETH14 failed to fill by the end of day and was canceled.  

Hi Pravin,

Have you tried setting the slippage to 0 to see if that helps? To override the default slippage models on the futures calendar, you need to use this line of code:

set_slippage(us_futures=slippage.FixedSlippage(0))  

One other thing to note with the futures calendar is that the only holidays that are handled normally are those that apply to all futures - Christmas Day, US New Years, and US Independence Day (July 4th). Outside of these holidays, there are other holidays that are observed by a subset of exchanges. Sometimes, there are even holidays that are observed by a subset of futures on the same exchange. For the holidays that are not observed by all futures, they will simply show up as having 0 volume on the given day, so you'll see orders on that day that appear not to fill.

For the partial orders, I'm not as sure. Can you try the zero-slippage model and let me know what happens?

Hi Jamie,

The above log is with set_slippage to 0. I think there are two issues:

  1. The partial orders. Even zero - slippage model does not work.
  2. The transactions in full backtest are wrong. They show very small amounts.

Are you sure that you don't consider the available volume in minute bar as the number of contracts and then look at the trade as number of contracts multiplied by contract size? I am just guessing that could be the reason.

Best regards,
Pravin

Hi Pravin,

Can you confirm that you are using the us_futures attribute in the set_slippage function? It's not something that we've documented yet, which is why I'd be surprised if you were already using it!

Ah! got it. I am not using that. Let me try with us_futures in set_slippage and see how it works.

Hi Jamie,

That works! Thank you very much.

Best regards,
Pravin