Learn R Programming

highfrequency (version 1.0.1)

plotTQData: Plot Trade and Quote data

Description

Plot trade and quote data, trades are marked by crosses, and quotes are plotted as boxes denoting the bid-offer spread for all the quotes.

Usage

plotTQData(
  tData,
  qData = NULL,
  xLim = NULL,
  tradeCol = "black",
  quoteCol = "darkgray",
  format = "%H:%M:%S",
  axisCol = "black",
  ...
)

Arguments

tData

cleaned trades data

qData

cleaned quotes data

xLim

timestamps for the start and the end of the plots.

tradeCol

color in which to paint the trade crosses.

quoteCol

color in which to fill out the bid-offer spread.

format

format string to pass to axis.POSIXct when creating the timestamps on the x axis. If you are plotting a very short time interval, use "%H:%M:%OS" to get fractional seconds on the time axis.

axisCol

string to denote which color to use for the x axis

...

passed to plot and points.

Examples

Run this code
if (FALSE) {
cleanedQuotes = quotesCleanup(qDataRaw = sampleQDataRaw, report = FALSE, printExchange = FALSE)
cleanedTrades <- tradesCleanupUsingQuotes(
        tData = tradesCleanup(tDataRaw = sampleTDataRaw, report = FALSE, printExchange = FALSE),
        qData = quotesCleanup(qDataRaw = sampleQDataRaw, report = FALSE, printExchange = FALSE)
        )[as.Date(DT) == "2018-01-03"]
xLim <- range(as.POSIXct(c("2018-01-03 15:30:00", "2018-01-03 16:00:00"), tz = "EST"))
plotTQData(cleanedTrades, cleanedQuotes, xLim = xLim, 
           main = "Raw trade and quote data from NYSE TAQ")
}

Run the code above in your browser using DataLab