Get stock quotes as JSON from Yahoo Finance with Start and End dates

Fizzix picture Fizzix · Jun 16, 2014 · Viewed 17.6k times · Source

I have been attempting to get a stock quote history from a specific symbol (BHP.AX) with a specific start and end date.

Here is my attempted query:

select * from yahoo.finance.quotes where symbol in ("BHP.AX") and startDate = "2014-01-01" and endDate = "2014-06-16"

I was testing it in the YQL console here: https://developer.yahoo.com/yql/console/

Am I missing something? Because the console does not seem to be spitting out the correct data.

Answer

Sathyajith Bhat picture Sathyajith Bhat · Jun 16, 2014

Am I missing something?

Yeah, yahoo.finance.quotes is part of community tables, so to test it out in YQL console, tick the Community tables checkbox.

Your YQL REST URL will be

https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22BHP.AX%22)&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=