QuantConnect / QuantConnect/Lean

Improve options and futures filter universes filtering performance

Open
#8,297 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

performance
Dominant language
C#
Stars
21.7k
Forks
5.3k
Avg merge
2d 22h
Merged PRs (30d)
34

Description

Expected Behavior

Options and futures filter universes filter methods enumerate (to filter) the data multiple times.

Actual Behavior

Evaluate whether the ContractSecurityFilterUniverse classes filter methods could have Enumnerable like behaviour, reducing the number of times the contracts are enumerated and filtered.

Potential Solution

Evaluate and find a way to chain the filters, like a Linq clause would. For instance, our OptionFilterUniverse Where extension (and other extensions and filter methods), which materializes the enumerable right away by calling ToList()

Reproducing the Problem

Any algorithm adding options like BasicTemplateOptionsAlgorithm. This would be a performance improvement.

System Information

N/A

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ContractSecurityFilterUniverse classes and the OptionFilterUniverse.Where extension linked in the issue, paying attention to where ToList() materializes the enumerable. Exercise the filters through BasicTemplateOptionsAlgorithm and compare the filtering behavior and enumeration work before and after the change. Done means the filters can be chained without changing their results and reduce repeated enumeration.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.