0

I'm working on extracting a date from a variable: "curIndex."

Here's what the code looks likes

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

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

And the output is this:

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

"NULL"

I'm working within ruleOrderProc of the quantstrat package.

The order time needs to be POSIXlt for the order book. Does anyone know what to do with this funky date format that I'm getting?

If so, thanks!

SymbolixAU
  • 25,502
  • 4
  • 67
  • 139
Saile
  • 115
  • 1
  • 11

1 Answers1

3

When all else fails, read the documentation. ;-) ?timestamp says:

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.

You probably meant to call time or index. Also, the time needs to be POSIXct for the order book, not POSIXlt.

Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418