exchangeHoursOnly: Extract data from an 'xts' object for the exchange hours only

View source: R/dataHandling.R

exchangeHoursOnlyR Documentation

Extract data from an xts object for the exchange hours only

Description

Filter raw trade data such and return only data between market close and market open. By default, marketOpen = "09:30:00" and marketClose = "16:00:00" (see Brownlees and Gallo (2006) for more information on good choices for these arguments).

Usage

exchangeHoursOnly(
  data,
  marketOpen = "09:30:00",
  marketClose = "16:00:00",
  tz = NULL
)

Arguments

data

a data.table or xts object containing the time series data. Multiple days of input are allowed.

marketOpen

character in the format of "HH:MM:SS", specifying the opening time of the exchange(s).

marketClose

character in the format of "HH:MM:SS", specifying the closing time of the exchange(s).

tz

fallback time zone used in case we we are unable to identify the timezone of the data, by default: tz = NULL. We attempt to extract the timezone from the DT column of the data, which may fail. In case of failure we use tz if specified, and if it is not specified, we use "UTC"

Value

xts or data.table object depending on input.

Author(s)

Jonathan Cornelissen, Kris Boudt, Onno Kleen, and Emil Sjoerup.

References

Brownlees, C. T. and Gallo, G. M. (2006). Financial econometric analysis at ultra-high frequency: Data handling concerns. Computational Statistics & Data Analysis, 51, pages 2232-2245.

Examples

exchangeHoursOnly(sampleTDataRaw)

jonathancornelissen/highfrequency documentation built on Jan. 10, 2023, 7:29 p.m.