Learn R Programming

highfrequency (version 1.0.1)

exchangeHoursOnly: 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
)

Value

xts or data.table object depending on input.

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"

Author

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

Run this code
exchangeHoursOnly(sampleTDataRaw)

Run the code above in your browser using DataLab