Table of Contents


File

kyles_lambda.m

Name

kyles_lambda

Synopsis

kyles_lambda - Calculates the Kyle's lambda (price impact liquidity measure).

Introduction

NOTE: PART OF A SET OF 2 RELATED FILES:

This approach is motivated by Kyles (1985) model in which liquidity is measured by a linear-regression estimate of the volume required to move the price of a security by one dollar. Sometimes referred to as Kyles lambda, this measure is an inverse proxy of liquidity, with higher values of lambda implying lower liquidity and market depth. The authors estimate this measure on a daily basis by using all transactions during normal trading hours on each day. The aggregate measure of market liquidity (MLI) is then given by the daily cross-sectional average of the estimated price impact coefficients.

License

=============================================================================

Copyright 2011, Dimitrios Bisias, Andrew W. Lo, and Stavros Valavanis

COPYRIGHT STATUS: This work was funded in whole or in part by the Office of Financial Research under U.S. Government contract TOSOFR-11-C-0001, and is, therefore, subject to the following license: The Government is granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license to reproduce, prepare derivative works, distribute copies to the public, perform and display the work.
All other rights are reserved by the copyright owner.

THIS SOFTWARE IS PROVIDED "AS IS". YOU ARE USING THIS SOFTWARE AT YOUR OWN RISK. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS, OR THE UNITED STATES GOVERNMENT BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

=============================================================================

Inputs

returns
Name:
returns
Description:

Time series returns for different securities.

Type:
float
Range:
(-inf,+inf)
Dimensions:

TxK matrix

  1. Rows represent dates, ascending.
  2. Columns represent returns for each of K securities.

prices
Name:
prices
Description:

Time series closing prices for different securities.

Type:
float
Range:
(0,+inf)
Dimensions:

TxK matrix

  1. Rows represent dates, ascending.
  2. Columns represent closing prices for each of K securities.

volumes
Name:
volumes
Description:

Time series trading volumes of the securities.

Type:
float
Range:
(0,+inf)
Dimensions:

TxK matrix

  1. Rows represent dates, ascending.
  2. Columns represent volumes for each of K securities.

Outputs

mli
Name:
mli
Description:

The aggregate measure of market liquidity (MLI) given by the daily cross-sectional average of the estimated price impact coefficients.

Type:
float
Range:
(-inf,+inf)
Dimensions:

scalar


Code

% Run warning message
warning('OFRwp0001:UntestedCode', ...
    ['This version of the source code is very preliminary, ' ...
     'and has not been thoroughly tested. Users should not rely on ' ...
     'these calculations.']);



num_days = size(returns,1);
num_securities = size(returns,2);

lambdas = zeros(num_securities,1);

% Loop through all the securities
for security = 1:num_securities
    y = returns(:,security);
    t = modified_sign(y); 
    X = [ones(num_days,1) t.*log(prices(:,security).*volumes(security))];

    betas = regress(y,X);
    lambdas(security) = betas(2);

end


% Aggregate measure of market liquidity
mli = mean(lambdas);

Examples

NOTE: Numbers used in the examples are arbitrary valid values.
They do not necessarily represent a realistic or plausible scenario.

First row of prices will only be used to generate returns, and then dropped. Calculate returns as price at i minus price at time i-1 / price at time i.

 volumes = ...
 [180, 250, 700;
 900, 400, 220;
 970, 590, 110;
 430, 260, 290;
 110, 600, 310];

 price_raw = ...
 [ 44, 82, 55;
 39, 81, 67;
 36, 79, 13;
 28, 40, 72;
 23, 26, 10;
 18, 13, 65];

 returns = (price_raw(2:end, :) ./ price_raw(1:(end-1), :)) - 1
 prices = price_raw(2:end,:);

 mli = kyles_lambda(returns, prices, volumes)

References

Khandani and Lo. (2011). What happened to the quants in August 2007? Evidence from factors and transactions data. Journal of Financial Markets, 14(1), 1-46.

Bisias et al. (2012). A survey of systemic risk analytics (Working paper #0001). Washington, DC: Office of Financial Research, 127-129.