Documentation of Data Measures
Here I provide a collection of various measures’ defnitions and source code in Python, SAS and/or other languages.
Some of the codes are used in production at my Research Data Services (RDS).
Variance Ratio Tests
A simple test for the random walk hypothesis of prices and efficient market.
The bid-ask spread scaled by bid-ask midpoint.
The effective spread is the difference between the natural logarithm of the actual transaction price and the natural logarithm of the midpoint prevailing at the time of the trade.
The temporary component of the effective spread. It measures the revenue to liquidity providers assuming that the liquidity provider is able to close her position at the midpoint prevailing five minutes after the trade.
A measure of market impact cost from Kyle (1985), which can be interpreted as the cost of demanding a certain amount of liquidity over a given time period.
The permanent component of the effective spread. It measures the gross losses to the liquidity demanders due to adverse selection (Glosten and Harris (1988)).
A spread decomposition model for estimating adverse selection.
The PIN of any asset captures the probability that a trade in that asset is initiated by an informed trader, developed in a series of papers, Easley, O’Hara, and co-authors (1992, 1996a, 1996b, 1997a, 1997b, 2002).
Jones (1991) model, modified Jones model, and Kothari et al (2005) model. Full description.