Yahoo option chain web page changed

Actually, from what I saw it actually seems like they made it very easy to request data. For example:
https://query2.finance.yahoo.com/v7...ted=true&lang=en-US&region=US&date=1469145600

Gets IBM option chain for July 22, 2016. I didn't look too deeply but there are other parameters that let you filter or request different parts of the data. results are standard JSON

Jerry Medved
https://www.medvedtrader.com

Great tip, John. Thank you.
Is there a way to get all the expiration dates in one page?
Thanks again.
Arturo
 
Great tip, John. Thank you.
Is there a way to get all the expiration dates in one page?
Thanks again.
Arturo
No, you have to loop through all the expiries.

Call a simplified version of the URL:
https://query1.finance.yahoo.com/v7/finance/options/APPL

That gets you a json response with underlying info, a list
of expiries and strikes, and the first expiries option chain.

If you are using python get the expiry list like this:


url = 'https://query1.finance.yahoo.com/v7/finance/option/AAPL'
uConn = urllib2.urlopen(url)
ii = uConn.readline()
ii = demjson.decode(ii)
uConn.close()
uaExpiries = ii['optionChain']['result'][0]['expirationDates']
 
No, you have to loop through all the expiries.

Call a simplified version of the URL:
https://query1.finance.yahoo.com/v7/finance/options/APPL

That gets you a json response with underlying info, a list
of expiries and strikes, and the first expiries option chain.

If you are using python get the expiry list like this:


url = 'https://query1.finance.yahoo.com/v7/finance/option/AAPL'
uConn = urllib2.urlopen(url)
ii = uConn.readline()
ii = demjson.decode(ii)
uConn.close()
uaExpiries = ii['optionChain']['result'][0]['expirationDates']

Thanks, Kevin. Appreciated.
 
Forgive me my ignorance, do you know how to read 'date=1469145600' exactly?

Tip, here how one can convert from epoch on Linux:

date -d @1469145600

or with a custom format:

date -d @1469145600 +"%d-%m-%Y %T %z"

get the current time in epoch:

date +%s
 
Back
Top