Ticker SPY 200226C00315000
From 2020-02-26 00:00:00
To 2020-02-26 00:00:00
Security Type Option
Market USA
Resolution Minute
Status Resolved

I can pull SPY call options data for days before the 26th and after in February. The following shows how I can get data for the 24th, but not the 26th. This is for the Research environment.

Code:

qb = QuantBook() spy = qb.AddEquity("SPY") spy_underlying_price = qb.History(spy.Symbol, datetime(2020, 2, 26, 9, 30, 59), datetime(2020, 2, 26, 9, 31, 0), Resolution.Second) sup_c = spy_underlying_price['close'] # 314.75 spy_option = Symbol.CreateOption(spy.Symbol, Market.USA, OptionStyle.American, OptionRight.Call, int(sup_c) + 1, # decimal strike datetime(2020, 2, 26)) # datetime expiry print("Option: " + spy_option.Value) spy_option_prices = qb.History(spy_option, datetime(2020, 2, 26, 9, 30, 0), datetime(2020, 2, 26, 10, 0, 0), Resolution.Minute) '''Why does this return a blank data frame?''' print(spy_option_prices) spy_option_prior_exp_day = Symbol.CreateOption(spy.Symbol, Market.USA, OptionStyle.American, OptionRight.Call, 324, # decimal strike datetime(2020, 2, 24)) # datetime expiry spy_option_prices_prior_exp_day = qb.History(spy_option, datetime(2020, 2, 24, 9, 30, 0), datetime(2020, 2, 24, 10, 0, 0), Resolution.Minute) print("Option: " + spy_option_prior_exp_day.Value) '''This has a filled data frame''' print(spy_option_prices_prior_exp_day)

Output: (abbreviated)

Option: SPY 200226C00315000 Empty DataFrame Columns: [] Index: [] Option: SPY 200224C00324000 askclose \ expiry strike type symbol time 2020-02-26 315.0 Call SPY XCCWB8AVKWVA|SPY 2T 2020-02-24 09:31:00 9.42 2020-02-24 09:32:00 9.88 2020-02-24 09:33:00 10.31 2020-02-24 09:34:00 10.39 2020-02-24 09:35:00 10.26

 

Author