You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.yahoo works 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.
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 regularMarketTime is UTC, so we might be able to do something as simple as .POSIXct(sq$regularMarketTime, tz = NULL) to get all the exchange-local market times into the user-local time. What do you think?
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.
When getQuote.yahoo was called it genereted errors when quotes from multiple timezones were involved. Fixed so everything is forced to the local timezone
Fixesjoshuaulrich#246
Nowadays I have same problem, I read the post "quantmod - getQuote() not working for tickers on different exchanges"
And I understood that the problem is in this part of the function:
Qposix <- sapply(split(sq, sq$exchangeTimezoneName), convertTZ)
So my question is, how can I fix this bug in the function that needs a change in the quantmod package?
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.yahoo
function 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.yahoo
works 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
The text was updated successfully, but these errors were encountered: