r-如何保存get.hist.quote中的交易日期



嗨,我用get.hist.quote下载数据,用"coredata"我节省了间谍的价格。相反,我如何将2006-12年的交易日期保存在矢量中?

library(tseries)
library(zoo)
SPY <- get.hist.quote("SPY",start = "2006-01-02",end = "2011-01-01",quote = "AdjClose", compression = "d",retclass = c("zoo","ts"))
L<-length(SPY)
SPY <- get.hist.quote("SPY",start = "2006-01-02",end = "2012-01-01",quote = "AdjClose", compression = "d",retclass = c("zoo","ts"))
X <- length(SPY)

下面是支持我的评论的测试代码:

dts <- as.Date( index(SPY), origin="2006-01-03")
> str(dts)
Date[1:1259], format: "2006-01-03" "2006-01-04" "2006-01-05" "2006-01-06" "2006-01-09" "2006-01-10" "2006-01-11" "2006-01-12" "2006-01-13" ...
> max(dts)
[1] "2010-12-31"

最新更新