[R-SIG-Finance] expanding xts object - adding a day

Martin Bauer Bauermartin at gmx.at
Mon Oct 31 13:58:11 CET 2011


Hi Brian,

yes rbind finally but I thinking of something like this - not sure if that could lead to a solution

library(xts)
library(quantmod)
sym=getSymbols("SPY",from="1900-01-01")
l=list()
L$Open <- xts(222, as.Date("2011-10-30"))
L$High <- xts(224, as.Date("2011-10-30"))
L$Low <- xts(220, as.Date("2011-10-30"))
L$Close <- xts(224, as.Date("2011-10-30"))
L$Volume <- xts(999, as.Date("2011-10-30"))
L$Adjusted <- xts(224, as.Date("2011-10-30"))
do.call("merge", L)
rbind(SPY,L)

but I get this error msg

Error in try.xts(list(Open = 222, High = 224, Low = 220, Close = 224,  : 
  Error in UseMethod("as.xts") :   no applicable method for 'as.xts' applied to an object of class "list"

I try this too
instead l=list()  I replaced it with l=xts()

also 

L<- xts(as.Date("2011-10-30",222,224,220,224,999,224))

ended with this error

Error in strptime(x, format, tz = "GMT") : invalid 'x' argument

I'm lost at this point



-------- Original-Nachricht --------
> Datum: Mon, 31 Oct 2011 07:11:26 -0500
> Von: "Brian G. Peterson" <brian at braverock.com>
> An: Martin Bauer <Bauermartin at gmx.at>
> CC: R Sig Finance <r-sig-finance at r-project.org>
> Betreff: Re: [R-SIG-Finance] expanding xts object - adding a day

> On Mon, 2011-10-31 at 08:39 +0100, Martin Bauer wrote:
> > library(quantmod)
> > indexes<-c("T","DIA")
> > 
> > running the script today - would give me data till last Friday. Now I
> > want to fill ie the DIA xts object with today's intraday price to
> > simulate today's close
> > 
> > How can I do this ? 
> 
> ?rbind
> 
> 

--



More information about the R-SIG-Finance mailing list