Learn R Programming

highfrequency (version 1.0.1)

mergeQuotesSameTimestamp: Merge multiple quote entries with the same time stamp

Description

Merge quote entries that have the same time stamp to a single one and returns an xts or a data.table object with unique time stamps only.

Usage

mergeQuotesSameTimestamp(qData, selection = "median")

Value

Depending on the input data type, we return either a data.table or an xts object containing the quote data which has been cleaned.

Arguments

qData

an xts object or data.table containing the time series data, with at least two columns named BID and OFR indicating the bid and ask price as well as two columns BIDSIZ, OFRSIZ indicating the number of round lots available at these prices. For data.table an additional column DT is necessary that stores the date/time information.

selection

indicates how the bid and ask price for a certain time stamp should be calculated in case of multiple observation for a certain time stamp. By default, selection = "median", and the median price is taken. Alternatively:

  • selection = "max.volume": use the (bid/ask) price of the entry with largest (bid/ask) volume.

  • selection = "weighted.average": take the weighted average of all bid (ask) prices, weighted by "BIDSIZ" ("OFRSIZ").

Author

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