I have SPX index options trade data only. I'm trying to import the options first through an initialize function and then through OnData and neither one is returning the data. 

from clr import AddReference

AddReference("System")
AddReference("QuantConnect.Algorithm")
AddReference("QuantConnect.Common")

from System import *
from System.Reflection import *

from decimal import Decimal
from enum import Enum
import calendar
from datetime import timedelta
import pandas as pd
import numpy as np

from QuantConnect import *
from QuantConnect.Parameters import *
from QuantConnect.Benchmarks import *
from QuantConnect.Brokerages import *
from QuantConnect.Util import *
from QuantConnect.Interfaces import *
from QuantConnect.Algorithm import *
from QuantConnect.Algorithm.Framework import *
from QuantConnect.Algorithm.Framework.Selection import *
from QuantConnect.Algorithm.Framework.Alphas import *
from QuantConnect.Algorithm.Framework.Portfolio import *
from QuantConnect.Algorithm.Framework.Execution import *
from QuantConnect.Algorithm.Framework.Risk import *
from QuantConnect.Indicators import *
from QuantConnect.Data import *
from QuantConnect.Data.Consolidators import *
from QuantConnect.Data.Custom import *
from QuantConnect.Data.Fundamental import *
from QuantConnect.Data.Market import *
from QuantConnect.Data.UniverseSelection import *
from QuantConnect.Notifications import *
from QuantConnect.Orders import *
from QuantConnect.Orders.Fees import *
from QuantConnect.Orders.Fills import *
from QuantConnect.Orders.Slippage import *
from QuantConnect.Scheduling import *
from QuantConnect.Securities import *
from QuantConnect.Securities.Equity import *
from QuantConnect.Securities.Forex import *
from QuantConnect.Securities.Interfaces import *
from datetime import date, datetime, timedelta
from QuantConnect.Python import *
from QuantConnect.Storage import *

QCAlgorithmFramework = QCAlgorithm
QCAlgorithmFrameworkBridge = QCAlgorithm
from QuantConnect.Securities.Option import OptionPriceModels

class SPXOptions(QCAlgorithm):
    def Initialize(self):

        self.bot = BOT()

        self.SetStartDate(
            self.bot.StartTime.year, self.bot.StartTime.month, self.bot.StartTime.day
        )  # Set Start Date
        self.SetEndDate(
            self.bot.EndTime.year, self.bot.EndTime.month, self.bot.EndTime.day
        )  # Set End Date
        self.SetCash(self.bot.InitialCash)  # Set Strategy Cash

        self.bot.CurrentDate = self.bot.StartTime.date()
        self.next_date = None

        self.spx = self.AddIndex("SPX", Resolution.Minute).Symbol

        self.contracts = []

        self.Schedule.On(
            self.DateRules.EveryDay(self._option.Symbol.Underlying),
            self.TimeRules.AfterMarketOpen(self._option.Symbol.Underlying, 5),
            Action(self.init_option_contracts),
        )



    def init_option_contracts(self):
        contracts = list(
            self.OptionChainProvider.GetOptionContractList(self.spx, self.Time)
        )
        price = self.Securities[self.spx].Price
        self.Debug(self.Time)

        lower_strike_bound = quantize(price - (self.bot.StrikePercent * price))
        upper_strike_bound = quantize(price + (self.bot.StrikePercent * price))

        puts = [i for i in contracts if i.ID.OptionRight == OptionRight.Put]


        self.contracts = [
            self.AddIndexOptionContract(put, Resolution.Minute) for put in puts
        ]
        return

    def option_filter_function(self, slice):
        price = self.Securities[self.spx].Price

        contracts = []
        for kvp in slice.OptionChains:
            if kvp.Key == self._option.Symbol:
                contracts = [x for x in kvp.Value]

        if len(contracts) < 5:
            # self.Debug(f'{self.Time} :: not enough contracts: {len(contracts)}')
            return

        times_to_expiry = [(i.Expiry - self.Time).days for i in contracts]
        self.Debug(f"{self.Time}\n{np.unique(times_to_expiry)}")
        return


        return

    def OnData(self, slice):
        self.bot.CurrentDate = self.Time.date()
        self.bot.CurrentTime = self.Time.time()

        if self.Portfolio.Invested:
            return

        if self.IsWarmingUp:
            return

        if not self.IsMarketOpen(self.spx):
            return

        # if len(self.contracts) < 1:
        #    self.Debug(f"{self.Time} - no optionchainprovider contracts yet")
        #    return

        self.option_filter_function(slice)
        return

 

The data structure looks like the following, within the local data folder:

13344_1622672770.jpg13344_1622672862.jpg

an example csv file within the zip looks like:

13344_1622673914.jpg

Not sure why the Option Data won't import. Please advise.