Add contract filters to futures chains and universes - #9791
Merged
jhonabreul merged 2 commits intoSep 14, 2026
Merged
Conversation
Split the contract filters shared by every derivative into IContractFilters, with IFutureContractFilters and IOptionContractFilters on top, and move the open interest and volume filters into ContractSecurityFilterUniverse so the futures universe gets them. Add BaseFutureFilterUniverse over the universe rows and the chain contracts, FuturesChainFilterUniverse, and FuturesChain filters that forward to it. The chain wrappers shared by OptionChain and FuturesChain live once in a BaseChain layer with the chain type and its filter universe as parameters. New futures filters: ContractMonth(year, month) and ContractMonths(months), by the contract month rather than the expiration month. FutureSymbol.IsStandard and FutureOptionSymbol.IsStandard back the standard and weekly filters. Tests: FuturesChainTests (parity with the universe, every universe filter declared on the interface, Python), FutureFilterTests, OptionChainTests, and the FuturesChainFiltersRegressionAlgorithm in C# and Python. The futures templates pick the front contract with the new filters.
Martin-Molinero
approved these changes
Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follows #9779 and #9783: the futures universe selection and
FuturesChainnow share one set of filters, like the option universe andOptionChaindo.What changes:
IContractFilters<TSelf>: the filters every derivative has (expirations,front_month(),back_months(),farthest_expiration(),zero_dte(), type, open interest, volume).IFutureContractFiltersaddsexpiration_cycle(), now taking anyIEnumerable<int>, andcontract_months();IOptionContractFilterskeeps the strike, right, moneyness, greeks and strategy filters.open_interest()andvolume()move from the option base toContractSecurityFilterUniverse, so futures universes get them. Future option universes still rejectopen_interest().BaseFutureFilterUniverse<TUniverse, TData>mirrors the option base.FutureFilterUniversekeeps its API;FuturesChainFilterUniverseruns the same filters over a chain's contracts.FuturesChaingets every filter, each returning a new chain. The wrappers shared withOptionChainlive once in aBaseChainlayer, with hooks to create the universe and the filtered chain.contract_months(months)selects by the contract month, the month the contract is named after.contract_months([3])includes the contract expiring in February.expiration_cycle()is unchanged and keeps matching the expiration month.BasicTemplateFuturesAlgorithmpicks the contract withexpiring_after(...).front_month()in both languages.Related Issue
N/A
Motivation and Context
Futures algorithms hand-roll the front contract past a roll date, the quarterlies, a contract by month code and the liquid ones. The option side got these as filters; this gives futures the same grammar.
Requires Documentation Change
Yes: the
FuturesChainfilters, andcontract_months(),open_interest()andvolume()on the futures universe.How Has This Been Tested?
FuturesChainTests: every chain filter returns the same contracts as the universe filter, alone and chained; the interfaces declare every universe filter; Python access.FutureFilterTests:contract_months()over ES and crude oil, where contract month and expiration month differ; expiration sets and bounds, open interest, volume,zero_dte().OptionChainTests: unchanged expectations over the shared base.FuturesChainFiltersRegressionAlgorithm(C# and Python): ES and GC universes selected with the filters, each filter checked onfutures_chain()and the slice chains, one trade.Types of changes
Checklist:
bug-<issue#>-<description>orfeature-<issue#>-<description>