Skip to content

Date format for quantmod SQLite tables

2 messages · Sean Carmody, Jeff Ryan

#
Hi Sean,

The wrapper in quantmod is mostly a 'how you might use' function.

That said, without any modification to the getSymbols.SQLite function,
you would need the row_names to be text representations of numeric
time, either POSIXct or Date.
[1] 14483
[1] 1251428145

As this gets converted via:

if (POSIX) {
            d <- as.numeric(fr[, 1])
            class(d) <- c("POSIXt", "POSIXct")
            fr <- xts(fr[, -1], order.by = d)
        }
        else {
            fr <- xts(fr[, -1], order.by = as.Date(as.numeric(fr[,
                1]), origin = "1970-01-01"))
        }

where POSIX=TRUE by default.

You could of course change the function to reflect your actual table
construction, and get rid of the as.numeric conversion, instead
calling as.Date or as.POSIXct directly.

HTH
Jeff
On Thu, Aug 27, 2009 at 9:30 PM, Sean Carmody<seancarmody at gmail.com> wrote: