问题
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.
回答1:
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
回答2:
There is a problem with the Yahoo finance API, they said something like they wasn't developing the finance tables for YQL... i'm researching a lot for getting that data here is something that maybe could help you:
edit: that link was for all company's option... Maybe this one could help:
https://query2.finance.yahoo.com/v7/finance/chart/ACAD160805C00029000?range=5d&interval=5m&includeTimestamps=false&corsDomain=finance.yahoo.com
来源:https://stackoverflow.com/questions/38680008/how-can-i-download-option-tables-using-the-yahoo-finance-api