View source: R/liquidityMeasures.R
getTradeDirection | R Documentation |
Function returns a vector with the inferred trade direction which is determined using the Lee and Ready algorithm (Lee and Ready, 1991).
getTradeDirection(tqData)
tqData |
|
NOTE: By convention the first observation is always marked as a buy.
A vector which has values 1 or (-1) if the inferred trade direction is buy or sell respectively.
Jonathan Cornelissen, Kris Boudt, Onno Kleen, and Emil Sjoerup. Special thanks to Dirk Eddelbuettel.
Lee, C. M. C. and Ready, M. J. (1991). Inferring trade direction from intraday data. Journal of Finance, 46, 733-746.
# Generate matched trades and quote data set
tqData <- matchTradesQuotes(sampleTData[as.Date(DT) == "2018-01-02"],
sampleQData[as.Date(DT) == "2018-01-02"])
directions <- getTradeDirection(tqData)
head(directions)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.