Lean
Lean copied to clipboard
Support extended market hours for futures
Description
- Add extended market hours for futures in
QCAlgorithm.Ad<Security>()methods. - The market hours database was updated to include extended hours for futures (sourced from IB TWS locally).
- A patch was added to
FuturesOptionsMarginModelGetMarginRequirement()checking that the underlying is defined and its price is not zero, to avoid division by zero issues (this will be considered in this issue and could be reverted after it is addressed). - The start/end dates were moved forward for some regression algorithms in order to include data for days where market is actually open:
-
AddFutureOptionContractDataStreamingRegressionAlgorithm -
AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm -
AutomaticIndicatorWarmupDataTypeRegressionAlgorithm -
ConsolidateRegressionAlgorithm
-
Related Issue
Closes #2470
Motivation and Context
Requires Documentation Change
How Has This Been Tested?
- Unit tests asserting that securities added with the methods mentioned above are properly added with extended market hours.
- Unit tests asserting that time rules work correctly for futures now that they allow extended market hours.
- Added new versions of several
BasicTemplateand other regression algorithms for futures with extended market hours. - New regression algorithms were added asserting that adding futures both with or without extended market hours, source the right data depending on the time (see
Algorithm.CSharp/FutureContractsExtendedMarketHoursRegressionAlgorithm.cs,Algorithm.CSharp/FuturesExtendedMarketHoursRegressionAlgorithm.csandAlgorithm.CSharp/FuturesExtendedMarketHoursTimeCheckRegressionAlgorithm.cs).
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] Refactor (non-breaking change which improves implementation)
- [ ] Performance (non-breaking change which improves performance. Please add associated performance test and results)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Non-functional change (xml comments/documentation/etc)
Checklist:
- [x] My code follows the code style of this project.
- [x] I have read the CONTRIBUTING document.
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.
- [x] My branch follows the naming convention
bug-<issue#>-<description>orfeature-<issue#>-<description>