High Frequency Trading in a Limit Order Book

소개글

오늘은 market microstructure 이론으로부터 어떻게 trading model을 만들어 내는지 보기 위해
논문 한 편을 소개해 드리겠습니다.

NYU 교수인 MARCO AVELLANEDA 와 Cornell 교수인 SASHA STOIKOV 가 쓴 논문입니다. 아래에 AVELLANEDA 교수 홈페이지에 실린 논문 pdf를 링크 시켰습니다.

High-frequency trading in a limit order book

저번에 소개해드린 Irene Aldridge의 High-frequency trading : a practical guide to algorithmic strategies and trading system 이란 책에 나와서 유명해진(?) 논문입니다.

이 논문에서는 트레이더의 risk preference 계수, 변동성, 현재 포지션, order impact 계수 등을 이용하여 현재의 중간가격으로부터 위 아래로 매수 매도 호가를 어느정도 벌려 놓아야 하는지를 계산하였습니다.

일단 information theory 부분을 사용하지 않았기 때문에 실전 적용 가능성을 떨어지지만 출발점으로써 꽤 좋은 논문이라고 생각됩니다.

논문 전체는 아래에 요약하여 놓았지만 결론만 정리하면 아래와 같은 수식을 이용하여 호가를 계산한다는 겁니다.

(1)
\begin{align} \delta^b = \dfrac{1}{\gamma}\log \left(1 + \dfrac{\gamma}{k} \right) + \dfrac{1}{2}\gamma\sigma^2(T-t) \left(1-\dfrac{q}{2} \right) \end{align}
(2)
\begin{align} \delta^a = \dfrac{1}{\gamma}\log \left(1 + \dfrac{\gamma}{k} \right) + \dfrac{1}{2}\gamma\sigma^2(T-t) \left(1+\dfrac{q}{2} \right) \end{align}

여기서 기호는 아래와 같습니다.

  • $\delta^b$ : 매수 호가 스프레드. 현재의 중간 가격과 매수 호가의 차이
  • $\delta^a$ : 매도 호가 스프레드. 매도 호가와 현재의 중간 가격의 차이
  • $\gamma$ : 트레이더의 risk preference를 나타내는 계수. 0 이면 risk neutral 즉 수익 변동성이 커져도 상관안함. 이 계수가 커질수로 리스크에 민감해짐
  • $k$ : order flow 계수, market buy volume에 대비하여 가격이 어느 정도 움직이는가와 limit order book에서 order flow shape의 형태를 나타내는 계수가 합쳐짐. order flow modeling을 통해 구함
  • $\sigma$ : 가격 변동성
  • $q$ : 현재 포지션, 한 주(계약)를 들고 있으면 +1, short이면 -1

트레이더의 risk preference 등은 설정에 의한 것이지만 order flow 모델링이 이루어지지 않으면 제대로 된 k 값은 구할 수 없을 것입니다.

이 논문은 information theory를 반영하지 않았기 때문에 그냥 현재의 중간값은 true value로 보고 있습니다.
좀 더 개량한다면 order flow 흐름으로부터 true value의 update값을 구하는 로직도 포함해야겠죠.

지금 이 로직의 성능을 back testing하는 코드를 만들고 있습니다. 완성이 되면 어떤 특성을 가지는지 보여드리도록 하겠습니다.

논문 요약본


Introduction

  • limit order book 에서 최적의 매수 매도 호가 제시하는 전략 연구
  • 딜러의 리스크 요인
    • 인벤토리 (포지션) 리스크
    • informed trader로 부터 오는 비대칭 정보 리스크
  • 기초 논문
    • Ho & Stoll (1981) : 독점적 딜러의 호가 전략
    • Ho & Stoll (1980) : 경쟁상태 딜러의 호가 전략
  • 관련 논문
    • Bouchaud et al. 2002
    • Luckock 2003
    • Potters and Bouchaud 2003
    • Smith et al. 2003
    • Maslow and Mills 2001
    • Weber and Rosenow 2005
    • Gabaix et al. 2006
  • 관련논문의 핵심
    • zero-intelligence agent를 도입하여 market dynamics 재현
    • market order의 size distribution
  • 본 논문의 전제
    • 인벤토리 리스크만 다룸.
    • 비 독점 딜러
    • mid price를 true price로 가정
  • 중요한 것은 딜러에게 도달하는 buy and sell order flow의 arrival rate
  • 주요 결과
    • 2 step 방법으로 매수매도호가 계산
      • (1) 현재 포지션을 기반으로 indifference valuation 계산
      • (2) mid-price와 호가 간의 거리를 이용하여 체결 확률 계산
  • 논문 순서
    • section 2
      • mid-price dynamics
      • agent's utility objective
      • arrival rate as a function of the distance from the mid-price
    • section 3
      • optimal quote
      • reservation price of the agent
      • approximate solution
      • simulation

The model

The mid-price of the stock

(3)
\begin{align} dS = \sigma dW \end{align}

The optimizing agent with finite horizon

  • agent's object:
    • maximize the expected exponential utility of P&L profile at a terminal time T
  • convex risk measure
    • can define reservation (or indifference) prices which are independent of the agent's wealth
  • inactive trader
    • no limit orders in the market
    • inventory of q stocks until the terminal time T (frozen inventory)
    • value function
(4)
\begin{align} v(x, s, q, t) = E_t [ -\exp ( -\gamma (x + q S_T))] \end{align}

* from the mid-price dynamics

(5)
\begin{align} v(x, s, q, t) = -\exp ( -\gamma x) \exp ( -\gamma q s) \exp ( -\dfrac{1}{2} \gamma^2 \sigma^2 q^2 (T-t)) \end{align}

where$s = S_t$

  • reservation bid (ask) price : $r^b$ ($r^a$)
    • the price that would make the agent indifferent between his current portfolio and his current portfolio plus (minus) one stock.
    • agent's subjective valuation
  • reservation : $r$
    • average of reservation ask price and reservation bid price
(6)
\begin{equation} v(x - r^b(s, q, t), s, q+1, t) = v(x, s, q, t) \end{equation}
(7)
\begin{equation} v(x + r^a(s, q, t), s, q-1, t) = v(x, s, q, t) \end{equation}

위 수식을 조합하면

(8)
\begin{align} r_a (s, q, t) = s + (1 - 2q) \dfrac{\gamma^2 \sigma^2 (T-t)}{2} \end{align}
(9)
\begin{align} r_b (s, q, t) = s - (1 + 2q) \dfrac{\gamma^2 \sigma^2 (T-t)}{2} \end{align}
(10)
\begin{align} r (s, q, t) = s - q \gamma^2 \sigma^2 (T-t) \end{align}

The optimizing agent with infinite horizon

  • (omitted)

Limit orders

  • agent's quote: $p^b$ and $p^a$
    • distance : $\delta^b = s - p^b$ and $\delta^a = p^a - s$
  • market buy order of size Q :
    • $p^Q$: the price of the highest limit order executed in this trade. $\Delta p = p^Q - s$
    • if $\delta^a < \Delta p$ , ask order will be executed
    • sell rate $\lambda^a ( \delta^a )$: decreasing function of $\delta^a$
    • buy rate $\lambda^b ( \delta^b )$: decreasing function of $\delta^b$
    • accumulated sell quantity $N^a_t$ : Poisson process dependent on $\lambda^a ( \delta^a )$
    • accumulated buy quantity $N^b_t$ : Poisson process dependent on $\lambda^b ( \delta^b )$
  • objective
(11)
\begin{align} \max_{\delta^a, \delta^b} E_t[ -\exp(-\gamma(X_T + q_T S_T))] \end{align}

where

  • inventory process
(12)
\begin{equation} q_t = N^b_t - N^a_t \end{equation}
  • cash wealth process
(13)
\begin{equation} X_t = p^a d N^a_t - p^b d N^b_t \end{equation}

The trading intensity

  • Limit order flow modeling factors
    • the overall frequency of market orders
    • the distribution of their size
    • the temporary impact of a large market order
  • Proposition 1 (arrival rate)
    • constant arrival rate $\Lambda$ = total trading volume divided by the average size of market orders
  • Proposition 2 (order size)
    • order size distribution : power law
    • US stocks : $\alpha = 1.53$
    • NASDAQ stocks : $\alpha = 1.4$
    • Paris Bourse : $\alpha = 1.5$
(14)
\begin{align} f^Q(x) \propto x^{-1-\alpha} \end{align}
  • Proposition 3 (market impact)
    • disagreement over how to define it and how to measure it
    • power proportional (Gabaix et al. 2006 or Weber and Rosenow 2005) or log proportional (Potters and Bouchaud 2003)
(15)
\begin{align} \Delta p \propto Q^\beta \end{align}

or

(16)
\begin{align} \Delta p = K \log Q \end{align}
  • log intensity
    • log proportional case
(17)
\begin{align} \lambda(\delta) = A \exp (-k\delta) \end{align}

where $A = \Lambda / \alpha$, $k = \alpha K$
* power proportional case

(18)
\begin{align} \Delta p \propto \log Q \end{align}

The solution

Optimal bid and ask quotes

  • dynamic programming using HJB (Hamilton-Jacobi-Bellman)
(19)
\begin{eqnarray} 0 = u_t + \frac{1}{2}\sigma^2 u_{ss} \\ + \max_{\delta^b} \lambda^b (\delta^b) [u(s, x-s+\delta^b, q+1, t) - u(s, x, q, t)] \\ + \max_{\delta^a} \lambda^a (\delta^a) [u(s, x+s+\delta^a, q-1, t) - u(s, x, q, t)] \\ \end{eqnarray}
(20)
\begin{align} u(s, x, q, t)] = -\exp(-\gamma(x+qs)) \end{align}

using

(21)
\begin{align} u(x, s, q, t) = -\exp ( -\gamma x) \exp ( -\gamma q \theta(s, q, t)) \end{align}

we can get

(22)
\begin{eqnarray} 0 = \theta_t + \frac{1}{2}\sigma^2 \theta_{ss} - \frac{1}{2} \sigma^2 \gamma \theta^2_s \\ + \max_{\delta^b} [ \dfrac{\lambda^b (\delta^b)}{\gamma}(1 - \exp(\gamma (s-\delta^b-r^b)))] \\ + \max_{\delta^a} [ \dfrac{\lambda^a (\delta^a)}{\gamma}(1 - \exp(\gamma (s+\delta^a-r^a)))] \end{eqnarray}
(23)
\begin{align} \theta^2(s, T) = 0 \end{align}
(24)
\begin{align} r^b(s, q, t) = \theta(s, q+1, t) - \theta(s, q, t) \end{align}
(25)
\begin{align} r^a(s, q, t) = \theta(s, q, t) - \theta(s, q-1, t) \end{align}

finally,

(26)
\begin{align} \delta^b = s - r^b(s, q, t) - \dfrac{1}{\gamma} \left( 1 - \gamma \dfrac{\lambda^b (\delta^b)}{\partial \lambda^b / \partial \delta) \delta^b} \right) \end{align}
(27)
\begin{align} \delta^a = r^a(s, q, t) -s + \dfrac{1}{\gamma} \left( 1 - \gamma \dfrac{\lambda^a (\delta^a)}{\partial \lambda^a / \partial \delta) \delta^a} \right) \end{align}
  • Two step method
    1. solve $\theta$ and $r^b$, $r^a$
    2. solve $\delta^b$, $\delta^a$

Asymptotic expansion in q

  • linear approximation of $\theta$
  • (omitted)
  • Result
(28)
\begin{align} \delta^b = \dfrac{1}{\gamma}\log \left(1 + \dfrac{\gamma}{k} \right) + \dfrac{1}{2}\gamma\sigma^2(T-t) \left(1-\dfrac{q}{2} \right) \end{align}
(29)
\begin{align} \delta^a = \dfrac{1}{\gamma}\log \left(1 + \dfrac{\gamma}{k} \right) + \dfrac{1}{2}\gamma\sigma^2(T-t) \left(1+\dfrac{q}{2} \right) \end{align}

Numerical simulations

  • selection of time step
    • must be small enough so that the probability of multiple orders reaching our agent is small
    • must be larger than the typical tick time, otherwise cannot get any orders
  • simulation setting
    • T = 1
    • sigma = 2
    • dt = 0.005
    • q = 0
    • gamma = 0.1
    • k = 1.5
    • A = 140
  • Inventory model is better than the symmetric model
  • if $\gamma \rightarrow 0$ (risk neutral), two models are identical