Here is an example on how to get JSON data from 2014-01-01 to 2015-01-01 for Apple (AAPL) through the Yahoo Finance API using YQL.
The YQL query is encoded at the URL:
select%20*%20from%20yahoo.finance.historicaldata%20where%20symbol%3D%22AAPL%22%20and%20startDate%3D%222014-01-01%22%20and%20endDate%3D%222015-01-01%22
So, if you decode it, you will get:
select * from yahoo.finance.historicaldata where symbol="AAPL" and startDate="2014-01-01" and endDate="2015-01-01"
Just change the date values ββto the ones you need and decode it all, for example, using this URL encoder: http://meyerweb.com/eric/tools/dencoder/
Then combine all of this by adding an encoded request to the request URL:
http://query.yahooapis.com/v1/public/yql?q={ENTER_QUERY_HERE}&env=http://datatables.org/alltables.env&format=json
So you get something like this:
http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.historicaldata%20where%20symbol%3D%22AAPL%22%20and%20startDate%3D%222014-01-01%22%20and%20endDate%3D%222015-01-01%22&env=http://datatables.org/alltables.env&format=json
Which will return you some great JSON-formatted data for the specified time period.
Timo
source share