Lean
Lean copied to clipboard
File-based options universe
Description
Refactor Equity and Index Option universe selection:
- Now file-based: option chains are directly read from files instead of being built from price data file names.
- Option contracts include more data at selection time, which means they can be filtered by their data:
- Data includes Greeks, Implied Volatility and Open Interest.
- New filters where added to allow this.
- History requests can now be used to fetch this options data, which would be like getting a full unfiltered option chain with the new additional data.
Notes about some algorithms with changed stats:
- Index BasicTemplateSPXWeeklyIndexOptionsAlgorithm:
- Stats change because since options universe data is daily, an additional Sample() calls is made on 2021/1/9 midnight
- IndexOptionScaledStrikeRegressionAlgorithm:
- Orders and stats change because now selection is immediate, so orders are place for the exact same options but an hour earlier, and price is different at that time.
- BasicTemplateOptionsFrameworkAlgorithm:
- Same contracts traded, just at different time of day with a different price
Related Issue
Part of #6861
Motivation and Context
- Performance improvements for options algorithms.
- Greeks and other data at selection time, which allows improved filtering.
Requires Documentation Change
New filters should be documented
How Has This Been Tested?
- Exisiting regression algorithms and unit tests.
- New regression algorithms and unit tests.
- Cloud tests:
- Sample options algorithms
- Backtesting:
- Launch algorithm running for 18 years with daily resolution, adding SPY options:
- Context: depends on year, but on average selecting 111 contracts from average of ~5000 contracts
- Master: ~85s
- Branch: ~50s (time reduced as expected)
- Launch algorithm running for 18 years with daily resolution, adding SPY options:
- Live deployments running thought multiple days with a bunch of logs:
- Look that first selection happens right after deployment.
- Look that selection happens everyday after data is available.
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] Refactor (non-breaking change which improves implementation)
- [x] 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>