Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch Stock For List of Symbols #1

Open
OptTrader opened this issue Aug 13, 2015 · 0 comments
Open

Fetch Stock For List of Symbols #1

OptTrader opened this issue Aug 13, 2015 · 0 comments

Comments

@OptTrader
Copy link

Hey Mike,

Awesome work on SwiftStock. I'm trying to play around with this to add fetch quotes for an array of symbols. I tried to add/modify fetchStockForSymbol method with the following:

class func fetchStockForListOfSymbols(#symbols: Array, completion:(stock: Stock) -> ()) {

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {

  let symbolsString:String = "\", \"".join(symbols)
  let encodedQuery = symbolsString.stringByAddingPercentEncodingWithAllowedCharacters(.URLHostAllowedCharacterSet())
  let stockURL = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22" + encodedQuery! + "%22)&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&format=json%22"

But I'm getting an Optional value found nil error under the NSCocoaErrorDomain? Any thought? Or does this require a complete new setup?

I want to get the data for tableView and PageViewController where each ViewController has its own quotes. Appreciate any advice.

Chris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant