Just deleted my whole answer and rewrote it to avoid confusion:
I looked into how to use YQL to query the yahoo finance API and here's what I ended up with:
Here is the completed code to fully formulate the request string. You can throw this directly into the NSURL for a NSMutableURLRequest and will get a json response. This code will fetch every property of each ticker. To change this you will need to specify individual properties instead of the * in this bit in the prefix (select%20*%20).
I took part of it from the sample code in this post. I modified the code to fit into an asynchronous request (also changed it slightly because part of it seemed outdated and wasn't working.
#define QUOTE_QUERY_PREFIX @"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20("
#define QUOTE_QUERY_SUFFIX @")%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json"
+ (NSString *)formulateYQLRequestFor:(NSArray *)tickers
{
NSMutableString *query = [[NSMutableString alloc] init];
[query appendString:QUOTE_QUERY_PREFIX];
for (int i = 0; i < [tickers count]; i++)
{
NSString *ticker = [tickers objectAtIndex:i];
[query appendFormat:@"%%22%@%%22", ticker];
if (i != [tickers count] - 1)
{
[query appendString:@"%2C"];
}
}
[query appendString:QUOTE_QUERY_SUFFIX];
return query;
}
You would invoke this by doing something like:
NSArray *tickerArray = [[NSArray alloc] initWithObjects:@"AAPL", @"VZ", nil];
NSString *queryURL = [MyClass formulateYQLRequestFor:tickerArray];
Use this answer to see how to formulate the request and consume the json that comes back.
Essentially the part you need to change is
NSURL *url = [NSURL URLWithString:queryURL];
You're also not sending JSON over so you should to change the request to reflect that.