Hi there
I am developing backtests for data including FutureOptions.

I have this function, which first find the future contract, then based on the contract and contract starts date it tries to get optionsContract but allOptionContract is always empty, any help appreciated.

The values I am calling the function is “HE”, “cme”, 2024, 12, Call, 80000

The contract found is HE13Z24, and targetContract.ID.Date is 2024-12-13
 

        private Symbol CreateFutureOptionSymbol(string underlying, string market, int year, int month, OptionRight? optionRight, decimal strike)
        {
            var futureSymbol = AddFuture(underlying, market: market).Symbol;
            var contracts = FutureChainProvider.GetFutureContractList(futureSymbol, new DateTime(year, month, 1));
            var targetContract = contracts
                .Where(c => c.ID.Date.Year == year && c.ID.Date.Month == month)
                .OrderBy(c => c.ID.Date)
                .FirstOrDefault();

            if (targetContract == null)
            {
                Error($"No future contract found for {underlying} in {year}-{month:D2}");
                return null;
            }

            var allOptionContract = OptionChainProvider.GetOptionContractList(targetContract, targetContract.ID.Date);