Lean icon indicating copy to clipboard operation
Lean copied to clipboard

Add Automatic Contract Rollover

Open haxdds opened this issue 5 years ago • 2 comments

Expected Behavior

Have user-defined future/option control rollover rules. This will be useful for trading continuous contracts for futures and certain option strategies that rely on rollovers.

Actual Behavior

Currently, contracts expire and positions are liquidated.

Potential Solution

Have user-defined rollover module which allows contracts to rollover on expiration.

Reproducing the Problem

Holding a contract until expiration liquidates our position and doesn't rollover.

System Information

Windows 10

Checklist

  • [x] I have completely filled out this template
  • [x] I have confirmed that this issue exists on the current master branch
  • [x] I have confirmed that this is not a duplicate issue by searching issues
  • [x] I have provided detailed steps to reproduce the issue

haxdds avatar Sep 18 '20 23:09 haxdds

Related to https://github.com/QuantConnect/Lean/issues/1650

Martin-Molinero avatar Oct 30 '20 15:10 Martin-Molinero

Initial discussion

future.SetRolloverModel()
MappingRolloverModel { }
  • AlgorithmManager 291 OnSymbolChanged event trigger ApplyRollover() model for future securities.
  • Give the model the algorithm or portfolio to place trades directly.
  • Best ease of use would be to allow purchase of continuous contract.
  • We should default to auto roll as its 10x easier than current manual rolling. Warning current users of manual rolling or disabling it based on trading the mapped symbol? 🤔 Or sadly slow rollout with transition period to let all the users know.
  • Create NullRolloverModel to disable auto rolling.
  • Create PythonRolloverModelWrapper for custom python implementations.

jaredbroad avatar May 08 '25 22:05 jaredbroad