[R-sig-finance] Its function and yahoo

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Wed May 4 10:01:17 CEST 2005


On Tue, 3 May 2005 22:16:37 -0400 Jonathan Q. wrote:

> from the perspective a newbie it seems  get.hist.quote() works
> reasonably well.

Please read this thread why I think that it should be improved.

> my issues come with (I think) the plot() part where the documentation
> doesn't seem to provide the solutions.
> 
> Consider the following...
> 
> x <- get.hist.quote(instrument = "CPN", quote = c("Ad", "Vol"), start
> = "2004-01-01"); plot(x, main = "Calpine",type='l')

And in which way is this not behaving as documented? If you should be
referring to the gaps, this is due to NAs. But you could do

z <- get.hist.quote(instrument = "CPN", quote = c("Ad", "Vol"),
  start = "2004-01-01", origin = "1970-01-01")
z <- as.zoo(z)
index(z) <- as.Date(index(z))
z <- na.omit(z)
plot(z)

to obtain a "zoo" object without NAs. Note, that I already pointed you
to this example.

> Hoow would I 
> a) have the date appear in years or months etc 

Look at ?aggregate.zoo and look into the archives of this mailing list.

> b) have the top part in semi-log form (so % changes are of equal
> vertical distances) and c) get the volume to scale down (say in
> millions of shares vs shares)

z[,"Volume"] <- z[,"Volume"]/1000000

and btw:

fortune("WTFM")

This is all documented in TFM. Those who WTFM don't want to have to WTFM
again on the mailing list. RTFM.
   -- Barry Rowlingson
      R-help (October 2003)

Z



More information about the R-sig-finance mailing list