Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upgetQuote.yahoo doesn't work correctly with tickers from different exchanges in other timezones #246
Comments
|
Thanks for the report! I can replicate. I don't believe I had a use case in mind when I wrote that code, but I anticipated it would be a problem. I'm not sure the current approach is required. It looks like Also, thanks for all your great answers on SO! I don't check the site as often as I used to, and I often find that you have answered questions quickly and adequately. |
|
You are welcome. I tested your suggestion. The outcome is indeed to simply change all of the following:
with: That returns everything in (the user's) local time. |
When getQuote.yahoo was called it genereted errors when quotes from multiple timezones were involved. Fixed so everything is forced to the local timezone Fixes joshuaulrich#246
|
Hi, It is very nice to read you both Nowadays I have same problem, I read the post "quantmod - getQuote() not working for tickers on different exchanges" So my question is, how can I fix this bug in the function that needs a change in the quantmod package? I'd thank you a lot, |
Description
When retrieving stock quote information from yahoo, you get an error when you have tickers from different exchanges with different timezones. If the number of tickers from each exchange are the same the function works (by accident). But if they have a different length, the function fails.
Minimal, reproducible example
I traced the problem to the part of the
getQuote.yahoofunction where the timezones are converted.This part returns a list of timezones, instead of a vector of timezones and when the data is transformed into a data.frame this part errors as the lengths of this variable are not the same as the length of the symbols.
If this part of the function is changed to the following code, the
getQuote.yahooworks again as expected.Qposix <- unlist(sapply(split(sq, sq$exchangeTimezoneName), convertTZ))More info on this SO post. A workaround is the request the info per exchange.
If you want I can create a pull request to fix this.
Session Info