Time is Money - Estimating the Cost of Latency in Trading

61
Introduction  P(up)  Hidden liquidity  Latency  Optimal liquidation  Conclusion Time is Money: Estimating the Cost of Latency in Trading Sasha Stoikov Cornell University April 16, 2015

description

Time is Money - Estimating the Cost of Latency in Trading

Transcript of Time is Money - Estimating the Cost of Latency in Trading

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 1/61

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Time is Money:Estimating the Cost of Latency in Trading

Sasha Stoikov

Cornell University

April 16, 2015

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 2/61

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Background

•  Automated or computerized trading•  Accounts for 70% of equity trades taking place in the US

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 3/61

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Background

•  Automated or computerized trading•  Accounts for 70% of equity trades taking place in the US

•  High frequency trading

•  Short position-holding periods•  Market-making (payment for order flow)•  Latency arbitrage across trading venues

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 4/61

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Background

•  Automated or computerized trading•  Accounts for 70% of equity trades taking place in the US

•  High frequency trading•

 Short position-holding periods•  Market-making (payment for order flow)•  Latency arbitrage across trading venues

•   Algorithmic trading•  Brokers executing large client transactions

•  Optimally splitting client orders•  Opportunistic trading algorithms (React, Bolt, Stealth,

Ambush, Guerrilla, Sniper)

I d i P( ) Hidd li idi L O i l li id i C l i

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 5/61

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Background

•  Automated or computerized trading•  Accounts for 70% of equity trades taking place in the US

•  High frequency trading•

 Short position-holding periods•  Market-making (payment for order flow)•  Latency arbitrage across trading venues

•   Algorithmic trading•  Brokers executing large client transactions

•  Optimally splitting client orders•  Opportunistic trading algorithms (React, Bolt, Stealth,

Ambush, Guerrilla, Sniper)

•  Why low-latency trading?

I t d ti P( ) Hidd li idit L t O ti l li id ti C l i

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 6/61

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Market twenty years ago: the pit

Introduction P(up) Hidden liquidity Latency Optimal liquidation Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 7/61

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Market today: the order book

Introduction P(up) Hidden liquidity Latency Optimal liquidation Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 8/61

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

The worst kept secret in HFT

SELL when imbalance   I   =  x x +y   is small, where x= bid size and y=

ask size

0 0.25 0.5 0.75 10

0.5

1

1.5

2

2.5x 10

4

I

      C     o    u     n      t     s

Imbalance before trade

Introduction P(up) Hidden liquidity Latency Optimal liquidation Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 9/61

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Outline

•  Why bid and ask sizes matter:•  Forecasting Prices from Level-I Quotes in the Presence of 

Hidden Liquidity, with M. Avellaneda and J. Reed•

 Modeling bid and ask sizes•  P(up): the probability that the price will move up•   The imbalance:   I   =   x 

x +y 

Introduction P(up) Hidden liquidity Latency Optimal liquidation Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 10/61

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Outline

•  Why bid and ask sizes matter:•  Forecasting Prices from Level-I Quotes in the Presence of 

Hidden Liquidity, with M. Avellaneda and J. Reed•

 Modeling bid and ask sizes•  P(up): the probability that the price will move up•   The imbalance:   I   =   x 

x +y 

•  Why latency matters:•  Optimal Asset Liquidation using Limit Order Book

Information, with R. Waeber•   Modeling latency•  Optimal liquidation time•   Trade regions

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 11/61

( p) q y y p q

Modeling Level I quotes

Assume the bid-ask spread is 1 tickOne of the following must happen first:

1  The ask queue is depleted and the price “moves up”.

2  The bid queue is depleted and the price “moves down”.

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 12/61

( p) q y y p q

Continuous model

•  Bid size:   x t 

•   Ask size:   y t 

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 13/61

( ) y y

Continuous model

•  Bid size:   x t 

•   Ask size:   y t 

•  The process (x t , y t ) can be approximated by the diffusion

dx t    =   σdW t 

dy t    =   σdZ t 

E  (dWdZ ) =   ρdt ,

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 14/61

Continuous model

•  Bid size:   x t 

•   Ask size:   y t 

•  The process (x t , y t ) can be approximated by the diffusion

dx t    =   σdW t 

dy t    =   σdZ t 

E  (dWdZ ) =   ρdt ,

•   τ x   and  τ y  are the times when the sizes hit zero

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 15/61

The diffusion

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 16/61

The partial differential equation

•   Let  u (x , y ) = P (τ y   < τ x |x t  = x , y t  = y ) be the probabilitythat the next price move is up, given the bid and ask sizes.

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 17/61

The partial differential equation

•   Let  u (x , y ) = P (τ y   < τ x |x t  = x , y t  = y ) be the probabilitythat the next price move is up, given the bid and ask sizes.

•   It solves the following PDE:

σ2 (u xx  + 2ρu xy  + u yy ) = 0,   x  > 0,   y  > 0,

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 18/61

The partial differential equation

•   Let  u (x , y ) = P (τ y   < τ x |x t  = x , y t  = y ) be the probabilitythat the next price move is up, given the bid and ask sizes.

•   It solves the following PDE:

σ2 (u xx  + 2ρu xy  + u yy ) = 0,   x  > 0,   y  > 0,

•   Boundary conditions

u (0, y ) = 0,   for   y  > 0,u (x , 0) = 1,   for   x  > 0.

The price moves as soon as  x t   or y t  hit zero

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 19/61

Solution

Theorem

The probability of an upward move in the mid price is given by

u (x , y ) = 1

2

1 −

Arctan 

1+ρ

1−ρ

y −x y +x 

Arctan 1+ρ

1−ρ

.   (1)

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 20/61

Uncorrelated queues (ρ = 0)

•   Problemu xx  + u yy   = 0,   x  > 0,   y  > 0,

and

u (0, y ) = 0,   for   y  > 0,

u (x , 0) = 1,   for   x  > 0.

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 21/61

Uncorrelated queues (ρ = 0)

•   Problemu xx  + u yy   = 0,   x  > 0,   y  > 0,

and

u (0, y ) = 0,   for   y  > 0,

u (x , 0) = 1,   for   x  > 0.

•  Solution

u (x , y ) =  2π

Arctan

.

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 22/61

Perfectly negatively correlated queues (ρ = −1)

•   Problem

u xx  − 2u xy  + u yy   = 0,   x  > 0,   y  > 0,

and

u (0, y ) = 0,   for   y  > 0,

u (x , 0) = 1,   for   x  > 0.

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 23/61

Perfectly negatively correlated queues (ρ = −1)

•   Problem

u xx  − 2u xy  + u yy   = 0,   x  > 0,   y  > 0,

and

u (0, y ) = 0,   for   y  > 0,

u (x , 0) = 1,   for   x  > 0.

•   Solutionu (x , y ) =

  x 

x  + y  .

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 24/61

The data

•  Best bid and ask quotes for tickers QQQQ, XLF, JPM, overthe first five trading days in 2010

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 25/61

The data

•  Best bid and ask quotes for tickers QQQQ, XLF, JPM, overthe first five trading days in 2010

•  All tickers are traded on various exchanges (NASDAQ, NYSEand BATS)

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 26/61

The data

•  Best bid and ask quotes for tickers QQQQ, XLF, JPM, overthe first five trading days in 2010

•  All tickers are traded on various exchanges (NASDAQ, NYSEand BATS)

•  Consider the perfectly negatively correlated queues model, i.e.

u (x , y ) =

  x 

x  + y 

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 27/61

Data sample

Obtained from the consolidated quotes of the NYSE-TAQdatabase, provided by WRDS

symbol date time bid ask bsize asize exchangeQQQQ 2010-01-04 09:30:23 46.32 46.33 258 242 TQQQQ 2010-01-04 09:30:23 46.32 46.33 260 242 TQQQQ 2010-01-04 09:30:23 46.32 46.33 264 242 TQQQQ 2010-01-04 09:30:24 46.32 46.33 210 271 PQQQQ 2010-01-04 09:30:24 46.32 46.33 210 271 PQQQQ 2010-01-04 09:30:24 46.32 46.33 161 271 P

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 28/61

Summary statistics

Ticker Exchange num qt qt/sec spread bsize+asize price

XLF NASDAQ 0.7M 7 0.010 8797 15.02XLF NYSE 0.4M 4 0.010 10463 15.01XLF BATS 0.4M 4 0.011 7505 14.99

QQQQ NASDAQ 2.7M 25 0.010 1455 46.30QQQQ NYSE 4.0M 36 0.011 1152 46.27QQQQ BATS 1.6M 15 0.011 1055 46.28

JPM NASDAQ 1.2M 11 0.011 87 43.81JPM NYSE 0.7M 6 0.012 47 43.77

JPM BATS 0.6M 5 0.014 39 43.82Table:  Summary statistics

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 29/61

Estimation procedure

1  We filter the data set by exchange and ticker

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 30/61

Estimation procedure

1  We filter the data set by exchange and ticker

2   We “bucket” the imbalance

I   =  x 

x  + y 

into intervals: 0 <  I  ≤ 0.05, 0.05 <  I  ≤ 0.1, etc..

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 31/61

Estimation procedure

1  We filter the data set by exchange and ticker

2   We “bucket” the imbalance

I   =  x 

x  + y 

into intervals: 0 <  I  ≤ 0.05, 0.05 <  I  ≤ 0.1, etc..

3  For each bucket, we compute the empirical probability that

the price goes up at the next price move,  u (I ).

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 32/61

Estimation procedure

1  We filter the data set by exchange and ticker

2   We “bucket” the imbalance

I   =  x 

x  + y 

into intervals: 0 <  I  ≤ 0.05, 0.05 <  I  ≤ 0.1, etc..

3  For each bucket, we compute the empirical probability that

the price goes up at the next price move,  u (I ).4  We plot the probability that the next price move is up,

conditional on the imbalance.

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 33/61

Probability of an upward move

as a function of the imbalance

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 34/61

Hidden liquidity

•  Empirically, the probability of the price going up when the asksize is small BUT does not tend to zero.

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 35/61

Hidden liquidity

•  Empirically, the probability of the price going up when the asksize is small BUT does not tend to zero.

•  Orders on other exchanges prevent the price from moving up(REG NMS)

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 36/61

Hidden liquidity

•  Empirically, the probability of the price going up when the asksize is small BUT does not tend to zero.

•  Orders on other exchanges prevent the price from moving up(REG NMS)

•  Hidden orders, iceberg orders, dark pools

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 37/61

Boundary condition

•  We model a fixed hidden liquidity  H 

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 38/61

Boundary condition

•  We model a fixed hidden liquidity  H •   This translates in

σ2 (p xx  + 2ρp xy  + p yy ) = 0,   x  > −H ,   y  > −H ,

with the boundary condition

p (−H , y ) = 0,   for   y  > −H ,

p (x ,−H ) = 1,   for   x  > −H .

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 39/61

Boundary condition

•  We model a fixed hidden liquidity  H •   This translates in

σ2 (p xx  + 2ρp xy  + p yy ) = 0,   x  > −H ,   y  > −H ,

with the boundary condition

p (−H , y ) = 0,   for   y  > −H ,

p (x ,−H ) = 1,   for   x  > −H .

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 40/61

Boundary condition

•  We model a fixed hidden liquidity  H •   This translates in

σ2 (p xx  + 2ρp xy  + p yy ) = 0,   x  > −H ,   y  > −H ,

with the boundary condition

p (−H , y ) = 0,   for   y  > −H ,

p (x ,−H ) = 1,   for   x  > −H .

•  In other words we can solve the problem with boundaryconditions at zero and use the relation

p (x , y ; H ) = u (x  + H , y  + H )

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 41/61

Perfectly negatively correlated queues (ρ = −1)

Solutionp (x , y ; H ) =

  x  + H 

x  + y  + 2H .

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 42/61

Estimation procedure

1  We filter the data set by exchange and ticker

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 43/61

Estimation procedure

1

 We filter the data set by exchange and ticker2  We “bucket” the imbalance in the intervals [0, 0.05),

[0.05, 0.1), etc...

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 44/61

Estimation procedure

1

 We filter the data set by exchange and ticker2  We “bucket” the imbalance in the intervals [0, 0.05),

[0.05, 0.1), etc...

3  For each bucket, we compute the empirical probability thatthe price goes up p̂ (I ).

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 45/61

Estimation procedure

1

 We filter the data set by exchange and ticker2  We “bucket” the imbalance in the intervals [0, 0.05),

[0.05, 0.1), etc...

3  For each bucket, we compute the empirical probability thatthe price goes up p̂ (I ).

4   The correlation  −1 model predicts

p  =  x  + H 

x  + y  + 2H   =

I  +   H x +y 

1 + 2   H x +y 

=  I  + h

1 + 2h  =

  1

1 + 2h(I −0.5)+0.5

where  h  is the normalized hidden size

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

E i i d

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 46/61

Estimation procedure

1

 We filter the data set by exchange and ticker2  We “bucket” the imbalance in the intervals [0, 0.05),

[0.05, 0.1), etc...

3  For each bucket, we compute the empirical probability thatthe price goes up p̂ (I ).

4   The correlation  −1 model predicts

p  =  x  + H 

x  + y  + 2H   =

I  +   H x +y 

1 + 2   H x +y 

=  I  + h

1 + 2h  =

  1

1 + 2h(I −0.5)+0.5

where  h  is the normalized hidden size5   We regress

p̂ (I ) − 0.5 = β (I  − 0.5) + 

and obtain an implied hidden liquidity  h = 0.5(1/β  − 1) for

each exchange.

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

P b bili f d

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 47/61

Probability of an upward move

hidden size= 0.09

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

R lt

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 48/61

Results

The hidden size tells us of how informative the level I quotes are.

Ticker NYSE BATS NASDAQ

XLF 0.21 0.09 0.09QQQQ 0.42 0.39 0.28

JPM 0.32 0.23 0.18

Table:  Implied hidden liquidity across tickers and exchanges

But this information decays with latency

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

L t

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 49/61

Latency

•  Latency arises in every trade execution:

1   Time of datafeed to travel from exchange to execution

machine;2   The algorithm making a decision;3   The order being sent back to the market.

•  We assume there is a fixed latency  L

•  What you see is   not what you get

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Th st f l t

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 50/61

The cost of latency

There is empirical evidence that selling on small imbalances can beprofitable:

•  On each quote   i , record the imbalance   I i  and the bid price  S b i •  At a later quote in the future   j ,  L  milliseconds later, record

the bid price  S b  j 

•  Take averages of (S b  j    − S b i  ) for   I i   in different buckets

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Cost as a fraction of the spread

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 51/61

Cost as a fraction of the spread

x axis is time, y axis is cost. Each graph is an imbalance decile.

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

The cost of latency

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 52/61

The cost of latency

Transaction cost for L=1ms, 10ms, 100ms, 1000ms

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

The Optimal Liquidation Problem

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 53/61

The Optimal Liquidation Problem

The imbalance process   I t   is a Markov process.

•   Goal:   Identify an optimal time  τ   in [0, T  − L] to sell the share

at the bid price, i.e.,

V (T , L, x ) = sup0≤τ ≤T −L

E [P b τ +L − P b 0 |I 0  = x ],

for x  ∈ [0, 1].

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Modeling the imbalance

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 54/61

Modeling the imbalance

•   I (n) for 0 ≤  n ≤ N   is a finite state Markov process.

•   20 transient states, (0, 0.05], (0.05, 0.1], etc...

•  Assume the bid ask spread equals the tick size

•  Assume that in a  dt  = 10 second time step, the price can onlygo up or down by one tick

•  We estimate the transition probabilities  p up ij   ,  p downij    and  p 

stay ij 

empirically

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Dynamic Program

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 55/61

Dynamic Program

•  We estimate the payoff function  G L(i ) = E [P b L  − P b 0 |I (0) = i ]

•  Bellman’s recursion:

V L(n, i ) = max

G L(i ), E [V L(n + 1, I (n + 1))|I (n) = i ]

,

•   Conditional probability:

E [V L(n + 1, I (n + 1))|I (n) = i ] =

20

k =1

p stay ik    V L(n + 1, k )

+

20k =1

p up ik  (V L(n + 1, k ) + 1) +

20k =1

p downik    (V L(n + 1, k ) − 1)

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Trade/no Trade Regions

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 56/61

Trade/no Trade Regions

Define

D  = (t , x ) ∈  [0, T ] × [0, 1) : V (t , x ) = G L(x ) ,

C   =

(t , x ) ∈  [0, T ] × [0, 1) : V (t , x ) <  G L(x )

.

Proposition

Fix  t  ∈ [0, T ], x  ∈ [0, 1], then  V L(t , x ) is decreasing in  L  forL ∈  [0, T ].

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Trade Regions on 4 different days

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 57/61

Trade Regions on 4 different days

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

The value function for T = 5 min

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 58/61

The value function for T 5 min

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Backtesting the Trade Regions

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 59/61

Backtesting the Trade Regions

1   The value function

V (T , L) =  1

20

20

i =1

V (T , L, i )

2   Out of sample performance

ˆV (T , L) = IMB (T , L)−TWAP (T ) =

  1

nT 

nT 

i =1

P b (τ i  + L) − P b (T i )

∆   ,

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Backtesting the Trade Regions for T = 5 min

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 60/61

g g 5

Introduction   P(up)   Hidden liquidity   Latency   Optimal liquidation   Conclusion

Conclusion

7/21/2019 Time is Money - Estimating the Cost of Latency in Trading

http://slidepdf.com/reader/full/time-is-money-estimating-the-cost-of-latency-in-trading 61/61

1  We can estimate the probability of the next price move:•  Conditional on the bid and ask sizes

•  Conditional on imbalance if the sizes are negatively correlated•  Conditional on hidden liquidity for a ticker/exchange pair

2  We can estimate the cost of latency:•  By solving an optimal stopping problem•  Backtesting trade/no trade regions on level I data