Semi-Markov model for market microstructure and HF trading LPMA, University Paris Diderot and JVN Institute, VNU, Ho-Chi-Minh City NUS-UTokyo Workshop on Quantitative Finance Singapore, 26-27 september 2013 Joint work with Pietro FODRA EXQIM and LPMA, University Paris Diderot
Financial data modelling Continuous time price process (P t ) t over [0, T ] observed at P 0, P τ,..., P nτ Different modelling of P according to scales τ and T : Macroscopic scale (hourly, daily observation data): Itô semimartingale Microscopic scale (tick data) High frequency
Euribor contract, 2010, for different observation scales EURIBOR [ T: 1 Y / freq: 1 hour ] Value 99.1 99.2 99.3 2010/01/04 10:00:00 2010/05/03 09:00:00 2010/09/01 09:00:00 2010/12/31 17:00:00 Date EURIBOR [ T: 1 d / freq: 1 sec ] Value 99.13 99.14 99.15 99.16 99.17 99.18 99.19 2010/05/05 09:00:03 2010/05/05 11:30:00 2010/05/05 14:00:00 2010/05/05 16:30:00 Date
Figure : Eurostoxx contract, 2010 may Semi-Markov 5, 9h-9h15, model for market tick frequency microstructure and HF trading Stylized facts on HF data Microstructure effects Discreteness of prices: jump times and prices variations (tick data) Mean-reversion: negative autocorrelation of consecutive variation prices Irregular spacing of jump times: clustering of trading activity EUROSTOXX [ T: 15m / freq: tick by tick ] 2655 2660 2665 2670 May 05 09:00:00 May 05 09:04:05 May 05 09:08:00 May 05 09:12:04
Limit order book Most of modern equities exchanges organized through a mechanism of Limit Order Book (LOB): 500 Best Bid 375 Best Ask Volume 250 BID/ASK spread 125 0 48,455 48,46 48,465 48,47 48,475 48,48 48,485 48,49 48,495 48,5 48,505 48,51 48,515 48,52 48,525 48,53 Price Figure : Instantaneous picture of a LOB
High frequency finance Two main streams in literature: Models of intra-day asset price Latent process approach: Gloter and Jacod (01), Ait Sahalia, Mykland and Zhang (05), Robert and Rosenbaum (11), etc Point process approach: Bauwens and Hautsch (06), Cont and de Larrard (10), Bacry et al. (11), Abergel, Jedidi (11), Sophisticated models intended to reproduce microstructure effects, often for purpose of volatility estimation High frequency trading problems Liquidation and market making in a LOB: Almgren, Cris (03), Alfonsi and Schied (10, 11), Avellaneda and Stoikov (08), etc Stochastic control techniques for optimal trading strategies based on classical models of asset price (arithmetic or geometric Brownian motion, diffusion models)
Objective Make a bridge between these two streams of literature: Construct a simple model for asset price in Limit Order Book (LOB) realistic: captures main stylized facts of microstructure Diffuses on a macroscopic scale Easy to estimate and simulate tractable (simple to analyze and implement) for dynamic optimization problem in high frequency trading Markov renewal and semi-markov model approach
References P. Fodra and H. Pham (2013a): Semi-Markov model for market microstructure, preprint on arxiv or ssrn P. Fodra and H. Pham (2013b): High frequency trading in a Markov renewal model.
Model-free description of asset mid-price (constant bid-ask spread) Marked point process Evolution of the univariate mid price process (P t ) determined by: The timestamps (T k ) k of its jump times N t counting process: N t = inf{n : n k=1 T k t}: modeling of volatility clustering, i.e. presence of spikes in intensity of market activity The marks (J k ) k valued in Z \ {0}, representing (modulo the tick size) the price increment at T k : modeling of the microstructure noise via mean-reversion of price increments P J₁ J₂ J₃ T₁ T₂ T₃ t
Semi-Markov model approach Markov Renewal Process (MRP) to describe (T k, J k ) k. Largely used in reliability Independent paper by d Amico and Petroni (13) using also semi Markov model for asset prices
Jump side modeling For simplicity, we assume J k = 1 (on data, this is true 99,9% of the times) : J k valued in {+1, 1}: side of the jump (upwards or downwards) J k = J k 1 B k (1) (B k ) k i.i.d. with law: P[B k = ±1] = 1±α 2 with α [ 1, 1). (J k ) k irreducible Markov chain with symmetric transition matrix: ) Q α = ( 1+α 2 1 α 2 1 α 2 1+α 2 Remark: arbitrary random jump size can be easily considered by introducing an i.i.d. multiplication factor in (1).
Mean reversion Under the stationary probability of (J k ) k, we have: α = correlation(j k, J k 1 ) Estimation of α: ˆα n = 1 n n J k J k 1 k=1 α 87, 5%, ( Euribor3m, 2010, 10h-14h) Strong mean reversion of price returns
Timestamp modeling Conditionally on {J k J k 1 = ±1}, the sequence of inter-arrival jump times {S k = T k T k 1 } is i.i.d. with distribution function F ± and density f ± : F ± (t) = P [ S k t J k J k 1 = ±1 ]. Remarks The sequence (S k ) k is (unconditionally) i.i.d with distribution: f + F = 1 + α 2 F + + 1 α F. 2 h + = 1+α 2 1 F is the intensity function of price jump in the same direction, h = 1 α f 2 1 F is the intensity function of price jump in the opposite direction
Non parametric estimation of jump intensity 0 5 10 15 f h[ ] h[+] 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1 s (quantile) Figure : Estimation of h ± as function of the renewal quantile
Simulated price Price simulation 10 9 8 7 6 5 4 3 2 1 0 1 P 0 47 111 176 349 447 533 599 688 755 818 886 968 1039 1121 1215 1295 1406 1493 1623 1700 1785 t(s) Figure : 30 minutes simulation Price simulation 62 56 50 44 38 32 26 20 14 9 4 0 P 0 804 1919 3148 4384 5623 6851 8079 9311 10650 12117 13670 15129 16650 18105 19558 21010 22463 23943 25491 26951 28424 t(s) Figure : 1 day simulation
Diffusive behavior at macroscopic scale Scaling: P (T ) t = P tt T, t [0, 1]. Theorem lim T P(T ) (d) = σ W, where W is a Brownian motion, and σ 2 is the macroscopic variance: ( 1 + α ) σ 2 = λ. 1 α with λ 1 = 0 tdf (t).
Mean signature plot (realized volatility) We consider the case of delayed renewal process: S n F, n 1, with finite mean 1/λ, and S 1 density λ(1 F ) Price process P has stationary increments Proposition V (τ) := 1 ( 2α ) 1 τ E[ (P τ P 0 ) 2 ] = σ 2 + Gα (τ) 1 α (1 α)τ, where G α (t) = E[α Nt ] is explicitly given via its Laplace-Stieltjes transform Ĝα in terms of F (s) := 0 e st df (t). V ( ) = σ 2, and V (0 + ) = λ. Remark: Similar expression as in Robert and Rosenbaum (09) or Bacry et al. (11).
Signature Plot C(tau) 0.0005 0.0010 0.0015 0.0020 0.0025 Data Simulation Gamma Poisson 0 500 1000 1500 2000 2500 3000 3500 tau(s) Figure : Mean signature plot for α < 0
Markov embedding of price process Define the the last price jump direction: I t = J Nt, t 0, valued in {+1, 1} and the elapsed time since the last jump: S t = t sup T k, t 0. T k t Then the price process (P t ) valued in 2δZ is embedded in a Markov process with three observable state variables (P t, I t, S t ) with generator: Lϕ(p, i, s) = ϕ + h + (s) [ ϕ(p + 2δi, i, 0) ϕ(p, i, s) ] s + h (s) [ ϕ(p 2δi, i, 0) ϕ(p, i, s) ],
Trading issue Problem of an agent (market maker) who submits limit orders on both sides of the LOB: limit buy order at the best bid price and limit sell order at the best ask price, with the aim to gain the spread. We need to model the market order flow, i.e. the counterpart trade of the limit order
Market trades A market order flow is modelled by a marked point process (θ k, Z k ) k : θ k : arrival time of the market order M t counting process Z k valued in { 1, +1}: side of the trade. Z k = 1: trade at the best BID price (market sell order) Z k = +1: trade at the best ASK price (market buy order) index n θ k best ask best bid traded price Z k 1 9:00:01.123 98.47 98.46 98.47 +1 2 9:00:02.517 98.47 98.46 98.46-1 3 9:00:02.985 98.48 98.47 98.47-1 Dependence modeling between market order flow and price in LOB: Cox marked point process
Trade timestamp modeling The counting process (M t ) of the market order timestamps (θ k ) k is a Cox process with conditional intensity λ M (S t ). Examples of parametric forms reproducing intensity decay when s is large: λ exp M (s) = λ 0 + λ 1 s r e ks λ power M (s) = λ 0 + λ 1s r 1 + s k. with positive parameters λ 0, λ 1, r, k, estimated by MLE.
First level limit orders First level limit orders Second level limit orders Second level limit orders First level limit orders First level limit orders First level limit orders First level limit orders Second level limit orders Strong and weak side of LOB BEST ASK PRX BEST ASK PRX BEST BID PRX BEST ASK PRX BEST BID PRX BEST BID PRX We call strong side (+) of the LOB, the side in the same direction than the last jump, e.g. best ask when price jumped upwards. We call weak side ( ) of the LOB, the side in the opposite direction than the last jump, e.g. best bid when price jumped upwards. We observe that trades (market order) arrive mostly on the weak side of the LOB.
Trade side modeling The trade sides are given by: Z k = Γ k I θ, k (Γ k ) k i.i.d. valued in {+1, 1} with law: for ρ [ 1, 1]. P[Γ k = ±1] = 1 ± ρ 2
Interpretation of ρ ρ = corr(z k, I θ ) k ρ = 0: market order flow arrive independently at best bid and best ask (usual assumption in the existing literature) ρ > 0: market orders arrive more often in the strong side of the LOB ρ < 0: market orders arrive more often in the weak side of the LOB Estimation of ρ: ˆρ n = 1 n n k=1 Z ki θ leads to ρ 50%: about k 3 over 4 trades arrive on the weak side. ρ related to adverse selection
Market making strategy Strategy control: predictable process (l + t, l t ) t valued in {0, 1} l + t l t = 1: limit order of fixed size L on the strong side: +I t = 1: limit order of fixed size L on the weak side: I t Fees: any transaction is subject to a fixed cost ε 0 Portfolio process: Cash (X t ) t valued in R, inventory (Y t ) t valued in a set Y of Z
Agent execution Execution of limit order occurs when: A market trade arrives at θ k on the strong (resp. weak) side if Z k I θ = +1 (resp. 1), and with an executed quantity k given by a distribution (price time priority/prorata) ϑ + L (resp. ) on {0,..., L} ϑ L The price jumps at T k and crosses the limit order price Remark ϑ ± L cannot be estimated on historical data. It has to be evaluated by a backtest with a zero intelligence strategy. Risks: Inventory price jump Adverse selection in market order trade
Market making optimization Value function of the market making control problem: v(t, s, p, i, x, y) = sup E [ ] PNL T CLOSE(Y T ) η RISK t,t (l +,l ) where η 0 is the agent risk aversion and: PNL t = X t + Y t P t, (ptf valued at the mid price) CLOSE(y) = (δ + ε) y, (closure market order) RISK t,t = T t Y 2 u d[p] u, (no inventory imbalance)
Variable reduction to strong inventory and elapsed time Theorem The value function is given by: v(t, s, p, i, x, y) = x + yp + ω yi (t, s) where ω q (t, s) = ω(t, s, q) is the unique viscosity solution to the integro ODE: [ t + s ] ω + 2δ(h + h )q 4δ 2 η(h + + h )q 2 + max L l + ω + l {0,1},q ll Y in [0, T ] R + Y. max L l ω = 0 l {0,1},q+lL Y ω q (T, s) = q (δ + ɛ)
L l ± = L l ±,M + Ll ±,jump favorable execution of random size L by market order L l ±,M ω := λ ±,M (s) [ω(t, s, q kl) ω(t, s, q) + (+δ ε)kl ] ϑ ± L (dk) unfavorable execution of maximal size L due to price jump L l ±,jump ω := h ±(s) [ ω(t, 0, ±q Ll) ω(t, s, q) + ( δ ε)ll ] with λ ±,M (s) := 1 ± ρ 2 λ M (s) (trade intensities)
Optimal policy shape: ρ = 0, execution probability = 10%
Optimal policy shape: ρ = 0, execution probability = 5%
Optimal policy shape: ρ = 0, 33, execution probability = 5%
Concluding remarks Markov renewal approach for market microstructure + Easy to understand and simulate + Non parametric estimation based on i.i.d. sample data + dependency between price return J k and jump time T k + Reproduces well microstructure effects, diffuses on macroscopic scale + Markov embedding with observable state variables ( Hawkes process approach) + Develop stochastic control algorithm for HF trading - MRP forgets correlation between inter-arrival jump times {S k = T k T k 1 } k Extension to multivariate price model Model with market impact for liquidation problem