Open zjorge96 opened 3 years ago
Made a quick tester program to check:
from yahoo_fin import options i = 0 while i < 100: closing_dates = options.get_expiration_dates("MOS") print(closing_dates) i += 1
After 39 iterations of it working correctly, the loop slows down and starts only grabbing the last two dates ['January 21, 2022', 'January 20, 2023']
Hello,
Has this issue been solved ? I am having the same problem. Sometimes it shows 3 expiration dates and sometimes it shows all:
This is so strange..
thanks,
Mathias
I have been running into an error where the "get_expiration_dates()" will return only a couple dates or an entirely empty list. For example when working it will return this: MOS ['June 25, 2021', 'July 2, 2021', 'July 9, 2021', 'July 16, 2021', 'July 23, 2021', 'July 30, 2021', 'September 17, 2021', 'December 17, 2021', 'January 21, 2022', 'January 20, 2023']
But will occasionally run something like this: MOS ['January 21, 2022', 'January 20, 2023'] or FMC [] Resulting in an error like below because there is no dates in the list. Traceback (most recent call last): File "c:\Users\User\Documents\options.py", line 300, in
bo.topFive(chosen_sector)
File "c:\Users\User\Documents\options.py", line 116, in topFive
call = self.closestCallStrike(sector[i], cur_stock_price, closing_dates[0])
IndexError: list index out of range