Skip to content

Commit

Permalink
Fix getQuote.yahoo for multiple timezones
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pverspeelt committed Oct 8, 2018
1 parent a8e9cb8 commit 3451f11
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions R/getQuote.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,7 @@ function(Symbols,what=standardQuote(),...) {
Qposix <- .POSIXct(sq[,"regularMarketTime"], tz=tz[1L])
} else {
warning("symbols have different timezones; converting to local time")
convertTZ <- function(x) {
tz <- x$exchangeTimezoneName[1]
times <- .POSIXct(x$regularMarketTime, tz)
attr(times, "tzone") <- NULL
times
}
Qposix <- sapply(split(sq, sq$exchangeTimezoneName), convertTZ)
Qposix <- .POSIXct(Qposix, tz=NULL) # force local timezone
Qposix <- .POSIXct(sq$regularMarketTime, tz = NULL) # force local timezone
}

Symbols <- unlist(strsplit(Symbols,','))
Expand Down

0 comments on commit 3451f11

Please sign in to comment.