[R-sig-finance] Using data from yahooImport (fBasics)

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Fri Apr 7 14:29:49 CEST 2006


On Fri, 07 Apr 2006 11:08:07 +0200 Diethelm Wuertz wrote:

> >This looks like hard work! It's easier using R + zoo:
> >
> Come On!!!!

Could we please *not* have discussions like this? This is not a
competition (at least IMHO).

I think we're all aware that Diethelm has a great collection of
financial functionality in the Rmetrics packages and I hope that most
users will agree that zoo has time series functionality with more
flexibility concerning the choice of date/time class and the more
standard interface. So it's the question how to get these work
together and not against each other.

> If it is really so easy in R+zoo, be fair enough and show us how we
> can do it in 10 or less lines!
> I'm waiting for it ...

Except for the alignment part which I've omitted for simplicity, you can
do:

## get data from yahoo
library("tseries")
dax <- get.hist.quote("^GDAXI", start = "2005-06-01")[, "Close"]
dcx <- get.hist.quote("DCX.DE", start = "2005-06-01")[, "Close"]

## merge -> returns -> lm
dcxdax <- merge(dcx, dax, all = FALSE)
ddret <- diff(log(dcxdax))
lm(dcx ~ dax, data = as.data.frame(ddret))

Best,
Z

> Thanks Diethelm
> 
> >       http://www.mayin.org/ajayshah/KB/R/html/o6.html
> >       http://www.mayin.org/ajayshah/KB/R/html/o5.html
> >
> >  
> >
> 
> _______________________________________________
> 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