getLiquidityMeasures {highfrequency} | R Documentation |
Compute Liquidity Measure
Description
Function returns an xts
or data.table
object containing 23 liquidity measures. Please see details below.
Note that this assumes a regular time grid.
Usage
getLiquidityMeasures(tqData, win = 300)
Arguments
tqData |
A |
win |
A windows length for the forward-prices used for ‘realized’ spread |
Details
NOTE: xts
or data.table
should only contain one day of observations
Some markets have publish information about whether it was a buyer or a seller who initiated the trade.
This information can be passed in a column DIRECTION
this column must only have 1 or -1 as values.
The respective liquidity measures are defined as follows:
effectiveSpread
where
is 1 (-1) if
was buy (sell) (see Boehmer (2005), Bessembinder (2003)). Note that the input of this function consists of the matched trades and quotes, so this is were the time indication refers to (and thus not to the registered quote timestamp).
realizedSpread: realized spread
where
is 1 (-1) if
was buy (sell) (see Boehmer (2005), Bessembinder (2003)). Note that the time indication of
and
refers to the registered time of the quote in seconds.
valueTrade: trade value
signedValueTrade: signed trade value
where
is 1 (-1) if
was buy (sell) (see Boehmer (2005), Bessembinder (2003)).
depthImbalanceDifference: depth imbalance (as a difference)
where
is 1 (-1) if
was buy (sell) (see Boehmer (2005), Bessembinder (2003)). Note that the input of this function consists of the matched trades and quotes, so this is were the time indication refers to (and thus not to the registered quote timestamp).
depthImbalanceRatio: depth imbalance (as ratio)
where
is 1 (-1) if
was buy (sell) (see Boehmer (2005), Bessembinder (2003)). Note that the input of this function consists of the matched trades and quotes, so this is were the time indication refers to (and thus not to the registered quote timestamp).
proportionalEffectiveSpread: proportional effective spread
(Venkataraman, 2001).
Note that the input of this function consists of the matched trades and quotes, so this is were the time indication refers to (and thus not to the registered quote timestamp).
proportionalRealizedSpread: proportional realized spread
(Venkataraman, 2001).
Note that the input of this function consists of the matched trades and quotes, so this is were the time indication refers to (and thus not to the registered
priceImpact: price impact
(see Boehmer (2005), Bessembinder (2003)).
proportionalPriceImpact: proportional price impact
(Venkataraman, 2001). Note that the input of this function consists of the matched trades and quotes, so this is where the time indication refers to (and thus not to the registered quote timestamp).
halfTradedSpread: half traded spread
where
is 1 (-1) if
was buy (sell) (see Boehmer (2005), Bessembinder (2003)). Note that the input of this function consists of the matched trades and quotes, so this is were the time indication refers to (and thus not to the registered quote timestamp).
proportionalHalfTradedSpread: proportional half traded spread
Note that the input of this function consists of the matched trades and quotes, so this is were the time indication refers to (and thus not to the registered quote timestamp).
squaredLogReturn: squared log return on trade prices
absLogReturn: absolute log return on trade prices
quotedSpread: quoted spread
Note that the input of this function consists of the matched trades and quotes, so this is where the time indication refers to (and thus not to the registered quote timestamp).
proportionalQuotedSpread: proportional quoted spread
(Venkataraman, 2001). Note that the input of this function consists of the matched trades and quotes, so this is where the time indication refers to (and thus not to the registered quote timestamp).
logQuotedSpread: log quoted spread
(Hasbrouck and Seppi, 2001). Note that the input of this function consists of the matched trades and quotes, so this is where the time indication refers to (and thus not to the registered quote timestamp).
logQuotedSize: log quoted size
(Hasbrouck and Seppi, 2001). Note that the input of this function consists of the matched trades and quotes, so this is where the time indication refers to (and thus not to the registered quote timestamp).
quotedSlope: quoted slope
(Hasbrouck and Seppi, 2001).
logQSlope: log quoted slope
midQuoteSquaredReturn: midquote squared return
where
.
midQuoteAbsReturn: midquote absolute return
where
.
signedTradeSize: signed trade size
where
is 1 (-1) if
was buy (sell).
Value
A modified (enlarged) xts
or data.table
with the new measures.
References
Bessembinder, H. (2003). Issues in assessing trade execution costs. Journal of Financial Markets, 223-257.
Boehmer, E. (2005). Dimensions of execution quality: Recent evidence for US equity markets. Journal of Financial Economics, 78, 553-582.
Hasbrouck, J. and Seppi, D. J. (2001). Common factors in prices, order flows and liquidity. Journal of Financial Economics, 59, 383-411.
Venkataraman, K. (2001). Automated versus floor trading: An analysis of execution costs on the Paris and New York exchanges. The Journal of Finance, 56, 1445-1485.
Examples
tqData <- matchTradesQuotes(sampleTData[as.Date(DT) == "2018-01-02"],
sampleQData[as.Date(DT) == "2018-01-02"])
res <- getLiquidityMeasures(tqData)
res