0
votes

Refer to the Yahoo finance webservice API, I unable to find http://finance.yahoo.com/webservice/v1/symbols/YHOO,AAPL/quote?format=json&view=detail

It shows 'Not a valid parameter'. I also discover it will direct to ?bypass=true How can I view the json data?

1

1 Answers

0
votes

My understanding is that json is only supported through Yahoo Query Language (yql) API. The API endpoint is http://query.yahooapis.com/v1/public/yql and you have to submit the query in the form as (prefixed with ?) q=select * from yahoo.finance.quotes where symbol in ('symbol1,symbol2'), you must also specify the format as format=json, you may also need to specify an environment in order for the data to be return correctly based on certain schema. So far I found env=store://datatables.org/alltableswithkeys works for me. The entire url of course has to be url-encoded, you can run a curl command to test it out (replace with actual stock symbol):

curl -G http://query.yahooapis.com/v1/public/yql? --data-urlencode "q=select * from yahoo.finance.quotes where symbol in ('symbol1, symbol2') --data-urlencode "format=json" --data-urlencode "env=store://datatables.org/alltableswithkeys"

For more information, please check YQL Guide. It took me hours of reading and try-and-error to make it work!