This is the code I have been using for a couple years now.

stockticker=yf.Ticker('AAPL')
ExpirationDates=stockticker.options

It used to give me a list of expiration dates for the option chains. Today it gives me an empty list. I tried using some archived old code and got the same result. Has yfinance changed recently? It's been a couple weeks since I used this portion of my code and I don't keep records of when it worked last but I believe it was working in early January 2024. Today (Jan 30,2024) it is not working.

I tried a quick standalone program:

        Stock='AAPL'
        self.stockticker=yf.Ticker(Stock)
        ExpirationDates=self.stockticker.options
        print(ExpirationDates)
        quit(99)

From which I get:

()

Process finished with exit code 99
1

There are 1 best solutions below

0
DirtFarmer On

So I went and uninstalled yfinance, then reinstalled it. It now works. I did not check the version before I reinstalled it but on my laptop I had 0.1.67 and the current version is 0.2.36 so that appears to have been the problem. Mea Culpa.

So I guess I'm still new to Python programming.

PS: 0.2.36 is dated 21 Jan 2024