Quantmod's getSymbols() fetches historical prices up till yesterday's close. I do my analysis in the morning and would like to update the series with the current quote (I only use adjusted prices). I can't seem to get it to work. When I use this code :
getSymbols('AGNC')
q <- getQuote('AGNC')
d <- Sys.Date()
qq<- q$Last
x <- zoo(qq,d)
t <- rbind.zoo(Ad(AGNC), x)
print(tail(t))
It prints out OK, but when I try to do something further, like:
dum <- dailyReturn(t)
I get the following error:
Error in colnames<-(*tmp*, value = "daily.returns") :
attempt to set colnames on object with less than two dimensions
Any ideas?
xtsinstead ofzoo? - GSee