[R-SIG-Finance] get.hist.quote

Gabor Grothendieck ggrothendieck at gmail.com
Fri Feb 9 15:02:40 CET 2007


Here is a kludge that will allow it to work until its fixed:


get.hist.quote <- function(...) {
	as.Date <- function(x, fmt, ...) {
		if (!missing(fmt)) fmt <- "%Y-%m-%d"
		base::as.Date(x, fmt, ...)
	}
	get.hist.quote <- tseries::get.hist.quote
	environment(get.hist.quote) <- environment()
	get.hist.quote(...)
}

# test
ibm <- get.hist.quote("ibm")



On 2/9/07, Josh Ulrich <joshulrich21 at hotmail.com> wrote:
> >All of a sudden get.hist.quote cease to function, i switched to zoo after i
> >totally failed to get yahooImport to work. I've been using the below R
> >snippet for weeks without any problems what so ever.
>
> <snip>
>
> >Error in if (!quiet && dat[n] != start) cat(format(dat[n], "time series
> >starts %Y-%m-%d\n")) :
> >          missing value where TRUE/FALSE needed
>
> This is because Yahoo recently changed the date format of its CSV files from
> "%d-%m-%y" to "%Y-%m-%d".  All that needs to be changed in 'get.hist.quote'
> is this line of code:
> from: dat <- as.Date(dat, "%d-%b-%Y")
> to: dat <- as.Date(dat, "%Y-%m-%d")
>
> Other similar functions (e.g. 'yahooImport') will likely have the same
> problem.
>
> _________________________________________________________________
> Check out all that glitters with the MSN Entertainment Guide to the Academy
> Awards(r)   http://movies.msn.com/movies/oscars2007/?icid=ncoscartagline2
>
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>
>



More information about the R-SIG-Finance mailing list