Hi community,

Thrilled to announce that the QuantConnect team is adding extended market hours support for futures in Lean.

From now on, the `AddFuture` API receives a `extendedMarketHours` which defaults to false, to indicate whether to include data from extended market. This means that when a future is added with `extendedMarketHours` set to true, data from every open hour will be included. Likewise, without `extendedMarketHours`, only data from regular hours will be included. Typically, futures market is open from Sunday evening to Friday evening, with a maintance hour every day, and regular hours spanning from 9:30am to 5:00pm, although this depends on the exchange and the future itself.

What behavior changes to expect

  • Your algorithms might experiement a decrease in data points given that by default only regular hours will be used.
  • If you set `extendedMarketHours` to true to be able to use the full market hours, and your algorithm is placing market orders during hours that are now considered extended market, your orders will be invalidated since market orders are not allowed outside or regular hours and MOO orders are not allowed at all for futures. Consider using limit orders (as ilustrated in several regression algorithms) when placing orders on extended market hours.

Placing orders

As mentioned above, you should consider using limit orders outside of regular hours for futures. As of now, for other securities types, Lean detects when a market orders is placed outside of regular hours and placed a MOO instead. Since futures don't have support for MOO orders, Lean will invalidate these orders for futures. There is a follow up issue to discuss the possibility of implementing this behavior for futures as well and convert market orders to limit orders during extended market hours.

Some example algorithms

 

Please let us know if you have any issues or concerns about this new feature so we can look into it asap.

Best,

Jhonathan