0
votes

i have the following code to get some data from the yahoo finance API:

JSONObject data;
String q = "select * from yahoo.finance.quote where symbol in (\"TSLA\",\"NFLX\")";

void setup(){
  data = loadJSONObject("https://query.yahooapis.com/v1/public/yql?" + q);
  println(data);
}

but when i run this code i get the following error:

https://query.yahooapis.com/v1/public/yql?select * from yahoo.finance.quote where symbol in ("TSLA","NFLX") does not exist or could not be read

does this mean this api is depreciated? or do i have a wrong url? could someone help me with this? the yahoo developer website is incredibly unclear :(

thank you in advance!!!!

1

1 Answers

0
votes

Take a look at the url in your code:

https://query.yahooapis.com/v1/public/yql?select%20*%20from%20yahoo.finance.quote%20where%20symbol%20in%20(%22TSLA%22,%22NFLX%22)

When I visit that, I get this error:

<error xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:lang="en-US">
<description>You must specify a yql statement (q=) to execute</description>
</error>

That tells me that you need a q= before the yql statement. So I add it:

https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quote%20where%20symbol%20in%20(%22TSLA%22,%22NFLX%22

When I visit that url, I get this error:

<error xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:lang="en-US">
<description>No definition found for Table yahoo.finance.quote</description>
</error>

I googled that error and found quite a few resources, including this one: YQL - No definition found for Table

According to that answer, there is some additional setup you have to do to access the yahoo.finance.quote table.