Calling list_options_contracts returns no results but making the same request directly does
Closed this issue ยท 1 comments
Describe the bug
Calling list_options_contracts
with the following parameters provides no result when using the python client but results are returned when making the request directly using the same parameters.
underlying_ticker=SPX
expiration_date=2022-06-10
strike_price.gte=3150.0
strike_price.lte=5260.0
expired=true
limit=1000
Making the same call directly with a valid api key returns results
curl https://api.polygon.io/v3/reference/options/contracts?underlying_ticker=SPX&expiration_date=2022-06-10&strike_price.gte=3150.0&strike_price.lte=5260.0&expired=true&limit=1000&apiKey=123456789ABCDEFGHIJK
To Reproduce
from datetime import date
from polygon import RESTClient
polygon_api_key = "๐๐๐๐๐๐๐๐๐๐๐๐"
client = RESTClient(api_key=polygon_api_key)
underlying_ticker="SPX"
expiration_date='2022-06-10'
strike_price_lte=5260.0
strike_price_gte=3150.0
c = list(client.list_options_contracts(
underlying_ticker=underlying_ticker,
expiration_date=expiration_date,
strike_price_lte=strike_price_lte,
strike_price_gte=strike_price_gte,
limit=1000,
expired=True,
))
Expected behavior
The specified option contracts returned
Screenshots
Additional context
Outputting all of the dates that don't return options gives:
['2021-06-10', '2021-06-15', '2021-06-17', '2021-06-22', '2021-06-24', '2021-06-29', '2021-07-01', '2021-07-08', '2021-07-15', '2021-07-20', '2021-07-22', '2021-07-27', '2021-07-29', '2021-08-03', '2021-08-05', '2021-08-10', '2021-08-12', '2021-08-17', '2021-08-19', '2021-08-24', '2021-08-26', '2021-09-02', '2021-09-09', '2021-09-16', '2021-09-21', '2021-09-23', '2021-09-28', '2021-10-05', '2021-10-07', '2021-10-12', '2021-10-14', '2021-10-19', '2021-10-21', '2021-10-26', '2021-10-28', '2021-11-02', '2021-11-04', '2021-11-09', '2021-11-11', '2021-11-16', '2021-11-18', '2021-11-23', '2021-12-02', '2021-12-07', '2021-12-09', '2021-12-14', '2021-12-16', '2021-12-21', '2021-12-28', '2021-12-30', '2022-01-04', '2022-01-06', '2022-01-11', '2022-01-13', '2022-01-20', '2022-01-27', '2022-02-01', '2022-02-03', '2022-02-08', '2022-02-10', '2022-02-15', '2022-02-17', '2022-02-24', '2022-03-03', '2022-03-08', '2022-03-10', '2022-03-15', '2022-03-17', '2022-03-22', '2022-03-24', '2022-03-29', '2022-04-05', '2022-04-07', '2022-04-12', '2022-04-19', '2022-04-21', '2022-04-28', '2022-05-05', '2022-05-12', '2022-06-20']
These are all Tuesdays and Thursdays with the exception of 2022-06-20 which was the (observed) Juneteenth holiday. Tuesday and Thursday expiration where added in 2022 so the missing data makes sense for all of the 2021 dates but not the 2022 dates after 2022-04-26.
Closing this as it looks like my issue was using 2021 vs. 2022