Yahoo Finance API with AJAX

There used to be Yahoo financial webservice where you could get historical stock data. API requests looked like

 http://finance.yahoo.com/webservice/v1/symbols/COALINDIA.NS/quote?format=json

and you got nice REST .json response. But this service has disappeared in middle of 2016. Only thing you get now, is Not a valid parameter response.  Here is stackoverflow question with details.

Nowadays there is Yahoo Query Language (YQL), but the financial API is still undocumented and not officially supported. Query for gathering historical data for AAPL look’s like:

select * from yahoo.finance.historicaldata where symbol = "AAPL" and startDate = "2016-01-01" and endDate = "2017-01-01"

You can try it at YQL Console. Notice that generated link contains env key at the end of THE REST QUERY url. It’s because it is community table you are querying.

...&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=For

If you want to make AJAX request you have to include env in your query like so:

Buy me a coffeeBuy me a coffee