Hi community!

Exited to share that we have shipped continuous futures into production. We have implemented 3 contract rolling methods, 4 price scaling adjustments as well as adding support for back months.

From now on, the canonical future returned by the `AddFuture` calls, is the new continuous future. Through this same `AddFuture` API you can specify which mapping, price scaling and front or back month configuration you want to use. The new continuous future security is setup as tradable and will never expire since it will map underlying future contracts accordingly, these mapping events will be fed into the algorithm (as Equities) through the `SymbolChangedEvent`.

Note that previously by default the addition of the canonical future to the algorithm, would feed data of the future chain contracts who's expiration were in the 0 to 35 day window. We have disabled this behavior making the continuous future the default data feed. Previous behavior can be recovered by specifying the expiration filter `future.SetFilter(timedelta(0), timedelta(35))`/`future.SetFilter(TimeSpan.Zero, TimeSpan.FromDays(35));`. 

Price Scalling

  • ForwardPanamaCanal: Eliminates price jumps between two consecutive contracts, adding a factor based on the difference of their prices. First contract is the true one, factor 0
  • BackwardsPanamaCanal: Eliminates price jumps between two consecutive contracts, adding a factor based on the difference of their prices. Last contract is the true one, factor 0
  • BackwardsRatio: Eliminates price jumps between two consecutive contracts, multiplying the prices by their ratio. Last contract is the true one, factor 1.
  • Raw: No price adjustment is made.

 

Contract Mapping

  • LastTradingDay: The contract maps on the previous day of expiration of the front month.
  • FirstDayMonth: The contract maps on the first date of the delivery month of the front month. If the contract expires prior to this date, then it rolls on the contract's last trading date instead.
  • OpenInterest: The contract maps when the back month contract has a higher traded volume that the current front month.


Front and Back Months

From the `AddFuture` API `contractDepthOffset` will allow specifying which contract to use, 0 (default) is the front month, 1 the following back month and so on. Initially we have added support for the first 2 back months contracts.

 

At the same time Lean internals mapping and scaling refactor has moved us closer to easily supporting other markets that would require these features, like Indian or European markets.

As always please let us know if you have any issues or concerns, and we will look into them ASAP.

 

Enjoy!

Author