R 中的格式 POSIX (quantstrat)

Format POSIX in R (quantstrat)

我正在努力从变量中提取日期:"curIndex."

代码如下所示

show(txntime1 <- timestamp(mktdata[curIndex+1L])[,1])

show(txntime <- strftime(txntime1, '%Y-%m-%d %H:%M:%OS6'))

输出是这样的:

"##------ Tue Mar 08 14:31:58 2016 ------##"

"NULL"

我在 quantstrat 包的 ruleOrderProc 内工作。

订单簿的订单时间需要POSIXlt。有谁知道如何处理我得到的这种时髦的日期格式?

如果是这样,谢谢!

当所有其他方法都失败时,请阅读文档。 ;-) ?timestamp 说:

The timestamp function writes a timestamp (or other message) into the history and echos it to the console. On platforms that do not support a history mechanism only the console message is printed.

您可能打算致电 timeindex。另外,订单簿的时间需要是POSIXct,而不是POSIXlt