Table of Contents


File

modified_sign.m

Name

modified_sign

Synopsis

modified_sign - Finds the sign of vector.

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

y
Name:
y
Description:

Time series returns for a given security.

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

Tx1 matrix

  1. Rows represent dates.

Outputs

t
Name:
t
Description:

The sign (+/-) to indicate net purchase / net sale was made for the day.

Type:
float
Range:
[-1,1]
Dimensions:

Tx1 matrix

  1. Rows represent dates.

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.']);


% If an element is 0 it returns the sign of the most recent non-zero
% element. If no most recent non-zero element exists it returns 0
t = zeros(length(y),1);
t(1) = sign(y(1));
for i=1:length(y)
    t(i) = sign(y(i));
    if t(i) == 0
        t(i)=t(i-1);
    end
end

Examples

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

 y = [-0.4695; 0.2441; 0.0000;-0.0201; 0.4047];

 t = modified_sign(y);

References

Abbe, E., Khandani, A., & Lo, A. (2011). Privacy-preserving methods for sharing financial risk exposures. Available at SSRN 1962090.

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