Learn R Programming

highfrequency (version 0.8.0)

makeRMFormat: Convert to format for realized measures

Description

Convenience function to split data from one xts or data.table with at least "DT", "SYMBOL", and "PRICE" columns to a format that can be used in the functions for calculation of realized measures.

Usage

makeRMFormat(data)

Arguments

data

An xts or a data.table object with at least "DT", "SYMBOL", and "PRICE" columns. This data should already be cleaned.

Value

An xts or a data.table object with columns "DT" and a column named after each unique entrance in the "SYMBOL" column of the input. These columns contain the price of the associated symbol.

Examples

Run this code
# NOT RUN {
library(data.table)
data1 <- copy(sampleTData)[,  `:=`(PRICE = PRICE * runif(.N, min = 0.99, max = 1.01),
                                               DT = DT + runif(.N, 0.01, 0.02))]
data2 <- copy(sampleTData)[, SYMBOL := 'XYZ']

dat <- rbind(data1, data2)
setkey(dat, "DT")
dat <- makeRMFormat(dat)

rCov(dat, alignBy = 'minutes', alignPeriod = 5, makeReturns = TRUE, cor = TRUE) 
# }

Run the code above in your browser using DataLab