I’m trying to follow the official Futures Universes documentation, and I subclassed FutureUniverseSelectionModel to override the filter method. However, even though my select_future_chain_symbols is used, the filter method seems to be completely ignored. I receive all contracts in on_data, not just the front month.

Why isn’t the filter method being executed?

from AlgorithmImports import *
from datetime import timedelta, datetime

class FrameworkFutureUniverseSelectionAlgorithm(QCAlgorithm):
    def initialize(self) -> None:
        self.set_start_date(2022, 1, 1)
        self.set_end_date(2022, 12, 31)
        self.set_cash(100000)

        self.universe_settings.asynchronous = True
        self.universe_settings.extended_market_hours = True
        self.universe_settings.resolution = Resolution.DAILY
        self.universe_settings.data_mapping_mode = DataMappingMode.OPEN_INTEREST
        self.universe_settings.data_normalization_mode = DataNormalizationMode.BACKWARDS_RATIO
        self.universe_settings.contract_depth_offset = 0
        self.add_universe_selection(FrontMonthFutureUniverseSelectionModel())

    def on_data(self, data: Slice) -> None:
        self.debug(f"{self.time}: === On Data ===")
        self.debug(f"Count: {len(self.active_securities)}")
        count = 0
        for kvp in self.active_securities:
            self.debug(f"Symbol: {kvp.key}")

class FrontMonthFutureUniverseSelectionModel(FutureUniverseSelectionModel):
    def __init__(self) -> None:
        super().__init__(timedelta(1), self.select_future_chain_symbols)

    def select_future_chain_symbols(self, utc_time: datetime) -> list[Symbol]:
        return [
            Symbol.create(Futures.Metals.GOLD, SecurityType.FUTURE, Market.COMEX)
        ]

    def filter(self, filter: FutureFilterUniverse) -> FutureFilterUniverse:
        return filter.front_month()