I have been trying to access 0DTE options data for SPX/SPY and I have not been able to find a way to access it in a research notebook. I have copy pasted the code that I am using to get options data for SPY and SPX.

 

import numpy as np
import pandas as pd

qb = QuantBook()
index_symbol = qb.AddIndex("SPX", Resolution.Minute).Symbol
option = qb.AddIndexOption(index_symbol)

eq_symbol = qb.AddEquity("SPY", Resolution.Minute).Symbol
eq_option = qb.AddOption(eq_symbol)

start_time = datetime.fromtimestamp((datetime.today().timestamp()//86400)*86400) - timedelta(days=4)
end_time = start_time + timedelta(days=3)

start_date = datetime(2022, 12, 31)

canonical_symbol = Symbol.CreateCanonicalOption(eq_symbol, "SPY", Market.USA, "?SPY")
contract_symbols = qb.OptionChainProvider.GetOptionContractList(canonical_symbol, start_date)


op = qb.History(TradeBar, contract_symbols, start_time, end_time)
display(op)
print(np.sort(op.index.get_level_values('expiry').unique()))

start_date = datetime(2022, 12, 31)

canonical_symbol = Symbol.CreateCanonicalOption(index_symbol, "SPXW", Market.USA, "?SPXW")
contract_symbols = qb.OptionChainProvider.GetOptionContractList(canonical_symbol, start_date)

op = qb.History(TradeBar, contract_symbols, start_time, end_time)
display(op)
print(np.sort(op.index.get_level_values('expiry').unique()))

 

From the output of print(np.sort(op.index.get_level_values('expiry').unique())), it is clear that the expires are either weekly or monthly. I would be grateful if someone could tell me if quantconnect has historical data on 0DTE options. If yes, what changes can I make in the code attached above to access this data for SPY or SPX or for both. Thanks.