[R-SIG-Finance] A problem about download stock data from yahoo

Joshua Ulrich josh.m.ulrich at gmail.com
Wed Jan 20 17:21:04 CET 2010


I've never heard of the "yahoo.get.hist.quote" function, though its
documentation says it's in tseries (which it isn't).  Though
tseries::get.hist.quote does exist.

I would recommend using quantmod's getSymbols function:
library(quantmod)
x <- getSymbols("0012.HK",auto.assign=FALSE)

Please note that you must turn off auto assignment because "0012.HK"
is an illegal object name because it starts with a number.

HTH,
Josh
--
http://www.fosstrading.com



On Thu, Jan 21, 2010 at 1:32 AM, zhucai4 <zhucai4 at gmail.com> wrote:
> Hello, everyone:
>
> I try to download the history data for a hongkong stock:0012.HK, using "yahoo.get.hist.quote", when I type the code:
>> library("UsingR")
>> instrument<-"0012.HK"
>> destfile<-"Henderson.csv"
>> yahoo.get.hist.quote(instrument,destfile,start=2008-1-1,end=2010-1-1,
> + quote="Close",download=TRUE,adjusted=TRUE,origin="1970-01-01", compression="d")
>
> there is an error message:
> Error in as.POSIXct.numeric(start, tz = "GMT") : 'origin' must be supplied
>
> I also try origin="1899-12-30", but the error message is still there.
>
> Did anyone encounter with this problem before ? Thank you very much for the help!
>
>
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>



More information about the R-SIG-Finance mailing list