How can I download option tables using the yahoo finance api?

user1067305 picture user1067305 · Jul 31, 2016 · Viewed 8.1k times · Source

Yahoo Finance changed its web page formats last week (again) and the data isn't copyable, downloadable, or scrapeable, since the data is apparently loaded indirectly. (I can see it in the debugger.)

The Yahoo Finance API doesn't currently return option data for a single option symbol, much less tables of or for expiration dates, nor apparently does YQL.

Has anyone successfully downloaded or scraped Options data from Yahoo finance in the past week? If so, how?

It probably isn't relevant, but I mainly use perl.

This question is about programming, since surely downloading data is part of programming.

Answer

dmayo picture dmayo · Oct 25, 2016

I have found an API that works since the change in Yahoo Finance. I'm still trying to find any clues to other APIs available.

Here's the base call. The {} is for either the number 1 or 2 as both work: query{}.finance.yahoo.com/v7/finance/

Now, as @Yago notes, you can append chart/ and you can also append options/. I'm looking for other options to append. Specifically I'd like to find Fundamental and Technical analysis like you can get from this oldie but goodie: http://finance.yahoo.com/d/quotes.csv?s=amd&f=nb4t8 (which returns: n=Name; b4=book value; t8=1yr target price)

The /v7 returns JSON which is nice. Thanks.

And to actually answer your question about option chains: https://query{1|2}.finance.yahoo.com/v7/finance/options/{ticker} you can also add a specific epoch date (with Hour,Min,Sec as zeros which will match up with output from Yahoo Finance) of an option expiry: https://query2.finance.yahoo.com/v7/finance/options/amd?date=1487289600