具有用于 HFT 的无间隔时间间隔的 xts 的 R 索引(跟进显示时间索引提示)
Joshua,
我希望您不会发现这是一种外行方法,但是当我尝试实现您的提示如何在我的 xts 对象上仅显示某些时间索引时,我总是得到空白数字。
> dput(x)
structure(c("BHP", "BHP", "BHP", "BHP", "BHP", "BHP", "N", "N",
"N", "N", "N", "N", "44560", "44560.0313951103", "44551.6606603345",
"44560", "44560", "44560", "39844", "1072460", "405128", "4911",
"2782", "1632", "44570", "44573.2273632603", "44579.8960524827",
"44577.1033732318", "44579.9904979095", "44574.9768058317", "80",
"13054", "88410", "13785", "5262", "1509", "12", "12", "12",
"12", "12", "12"), .indexCLASS = structure("timeDate", package = "timeDate"),
.indexTZ = "", class = c("xts", "zoo"), index = structure(c(1306922412,
1306922414, 1306922415, 1306922416, 1306922417, 1306922418), tzone = "",
tclass = structure("timeDate", package = "timeDate")), .Dim = 6:7, .Dimnames =
list(NULL, c("SYMBOL", "EX", "BID", "BIDSIZ", "OFR", "OFRSIZ","MODE")))
> x["T10:00:14/T10:00:17"]
SYMBOL EX BID BIDSIZ OFR OFRSIZ MODE
因此,尽管这些值显然存在,但我没有得到任何值,我错过了什么?
Joshua,
I hope you do not find this to be a layman approach but when I tried to implement your hint how to display only certain time index on my xts object i always get blank figures.
> dput(x)
structure(c("BHP", "BHP", "BHP", "BHP", "BHP", "BHP", "N", "N",
"N", "N", "N", "N", "44560", "44560.0313951103", "44551.6606603345",
"44560", "44560", "44560", "39844", "1072460", "405128", "4911",
"2782", "1632", "44570", "44573.2273632603", "44579.8960524827",
"44577.1033732318", "44579.9904979095", "44574.9768058317", "80",
"13054", "88410", "13785", "5262", "1509", "12", "12", "12",
"12", "12", "12"), .indexCLASS = structure("timeDate", package = "timeDate"),
.indexTZ = "", class = c("xts", "zoo"), index = structure(c(1306922412,
1306922414, 1306922415, 1306922416, 1306922417, 1306922418), tzone = "",
tclass = structure("timeDate", package = "timeDate")), .Dim = 6:7, .Dimnames =
list(NULL, c("SYMBOL", "EX", "BID", "BIDSIZ", "OFR", "OFRSIZ","MODE")))
> x["T10:00:14/T10:00:17"]
SYMBOL EX BID BIDSIZ OFR OFRSIZ MODE
So I get no values though the values are clearly there, what am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您没有说明如何创建 xts 对象,但我认为这是 xts 创建对象方式的一个小错误 - 它没有从 timeDate 对象中添加 TZ。
尝试:
HTH
Jeff
w.rt 这个错误 - 我会调查并修补。谢谢。
You don't say how you are creating the xts object, but I think it is a small bug in how xts is creating the object - it is not adding in the TZ from the timeDate object.
Try:
HTH
Jeff
w.r.t. the bug - I'll look into and patch. Thanks.
当在秒级规范中使用时,我无法使 ?"[.xts" 中描述的形式正常工作,但我看到 Jeff R 已经到达现场并证明了
indexTZ(x) < ;- “GMT”
机动(我查看的许多帮助页面中都没有引用,但这是必要的。I could not get the form described in ?"[.xts" to work when being used at the seconds-level of specification, but I see that Jeff R has arrived on the scene and demonstrated that the
indexTZ(x) <- "GMT"
maneuver (not referenced from any of many the help pages I looked at, is necessary.