Peng Wu

Marcello Rambaldi

Jean-François Muzy

Emmanuel Bacry

A single queue-reactive Hawkes model for the order flow

Keywords: Limit order book, market micro structure, Hawkes process, high frequency data, jump Markov process, ergodic properties, market simulator

de niveau recherche, publiés ou non, émanant des établissements d'enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

Introduction

Building faithful models for the Limit Order Book (LOB) is a longstanding issue on which many efforts have been invested in the quantitative finance community. A rich literature of theoretical and empirical studies of limit order books has emerged in the last decade (see, e.g., [START_REF] Martin D Gould | Limit order books[END_REF] and [START_REF] Abergel | Limit order books[END_REF] for a recent review). Modeling the LOB is a challenging task due to its intricate dependence structure. Indeed, the configuration of the limit order book is determined by the arrival of multiple types of orders: limit, cancel and market orders in the simplest setting, and the way these orders arrive on the market is non-trivial. For example, it is well known that order arrival inter-event times present strong and persistent autocorrelation (see e.g. [START_REF] Chakraborti | Econophysics review: I. Empirical facts[END_REF]), implying that past order flow influences the current state of the book. At the same time, anecdotal as well as empirical evidence ( [START_REF] Lehalle | Optimal liquidity-based trading tactics[END_REF]) suggests that market participants look at the state of the order book in order to take their trading decisions. Models for the LOB can be roughly divided into two main classes. On one side are the models developed by the economics community where the focus is on the behavior of rational agents that act strategically to optimize their utility function (see e.g. [START_REF] Parlour | Limit order markets: A survey[END_REF]). Another stream of literature, beginning notably with [START_REF] Smith | Statistical theory of the continuous double auction[END_REF], focus instead on the overall statistical properties of LOBs and assumes a certain simplified dynamics for the order flow in order to build mathematically tractable models that can reproduce at least partially some of these observed properties. This work contributes to the latter and builds on previous works in this field. As stated above, in the pioneering work [START_REF] Smith | Statistical theory of the continuous double auction[END_REF], the order book is seen as a purely stochastic system -a so called zero intelligence model -where orders arrive randomly, and where the interest is making testable predictions based on measurable inputs. [START_REF] Cont | A stochastic model for order book dynamics[END_REF] is one of the first paper to clearly frame the problem of LOB modeling in the context of queuing theory and Markov chains. By leveraging the properties of Markov chains, the authors are able to derive several conditional probabilities such as the likelihood of a mid-price move or the probability of a limit order execution before a price change. The authors of [START_REF] Abergel | A Mathematical Approach to Order Book Modeling[END_REF] keep the same assumption of Poisson-driven independent queues and prove, using the theory of infinitesimal generators and Lyapunov stability criteria, the importance of the cancellation structure to ensure the stability of the LOB distribution and also show that under their model the price process converges to a Wiener process. Although the hypothesis made by these models are in disagreement with empirical facts, they present the advantage of being very tractable and to allow the derivation of many useful quantities analytically. In [START_REF] Abergel | Long Time Behaviour of a Hawkes Process-Based Limit Order Book[END_REF], the authors drop the assumption of uncorrelated order flow and introduce some memory effect by choosing to model the rate of limit and market order arrival, λ L and λ M by a Hawkes process ( [START_REF] Hawkes | Spectra of some self-exciting and mutually exciting point processes[END_REF])

λ (t) = µ + m φ m (t -s)dN m s . (1)
By setting the kernel function φ to an exponential form φ(t) = αe -βt the process (λ, N ) has the Markov property and thus the authors are able to use a similar machinery to [START_REF] Abergel | A Mathematical Approach to Order Book Modeling[END_REF] in order to study the limiting behavior of their model. In [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF] and [START_REF] Rambaldi | The role of volume in order book dynamics: a multivariate hawkes process analysis[END_REF], the authors also use multivariate Hawkes processes to analyze the order flow interaction at the fist level of the order book. Their model is calibrated without any assumption on the Hawkes kernel shapes using a non-parametric method.

In [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF], the authors focus instead on the influence of the current state of the LOB on trading decisions. They propose a simple Markov model where the order flow arrival intensity depends only on the currently state of LOB through the available volume. They established conditions under which their model possess ergodic properties, making it possible to reproduce the empirical LOB queue size distributions as the invariant distribution of a Markov process. More recently, [START_REF] Lu | Order-book modelling and market making strategies[END_REF] extended the model of [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF] by allowing the order book dynamics to depend also on the type of the order that led to a complete depletion of a level (i.e. a market or cancel order) and also by taking into account the order size. [START_REF] Lu | Order-book modelling and market making strategies[END_REF] thus depart slightly form the pure Markovian framework. They then discuss optimal market making strategies in the context of the model and also assess their performance on real data.

In this paper, we aim at contributing to this stream of literature by building on the work of [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF] on one side and on the one of [START_REF] Abergel | Long Time Behaviour of a Hawkes Process-Based Limit Order Book[END_REF] and [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF] on the other side by presenting a model where both dependence on past order flow and dependence on the state of the LOB are present. More precisely, we propose to consider stochastic LOB models that are multivariate Hawkes models whose parameters explicitly depend on the queue sizes of the order book. For a given set of event types that can occur in the considered LOB model, if q(t) represents the state of the book queues at some given time t, such a model could be simply written as the following generalization of the standard multivariate Hawkes model (Eq. ( 1)):

λ (t) = µ ( q(t)) + m φ m (t -s, q(t)) dN m s .

(

) 2
where we have accounted for the possible explicit dependence on the queue sizes of both the exogenous intensities µ and interaction kernels φ m . We call this class of models Queue Reactive Hawkes (QRH) models. Let us notice that the issue of considering both self-excitation effects and dependence on some given state within a single model has also been considered very recently (during the completion of the present work) by Morariu-Patrichi and Pakkanen [START_REF] Morariu | State-dependent Hawkes processes and their application to limit order book modelling[END_REF]. These authors proposed a general framework called "state dependent Hawkes process" where the Hawkes kernels φ are functions of some state process X(t) that can take a finite number of values and that switches from one state to another one when an event of the Hawkes process occurs and according to a transition rule that depends on the type of this event. The specific application of this framework to LOB modeling proposed in [START_REF] Morariu | State-dependent Hawkes processes and their application to limit order book modelling[END_REF] mainly consists in considering either the volume imbalance or the spread as the state variable. Let us mention another very recent and related work in the paper of Daw and Pender [START_REF] Daw | The Queue-Hawkes Process: Ephemeral Self-Excitement[END_REF] that defined and studied a Markov process constructed a pair of inter-dependent processes (N t , Q t ), where N t is a counting process and Q t a queuing process.

In this paper our purpose is twofold: We first investigate in which respect adding Hawkes self-and crossexcitation properties to the "Queue Reactive" model of Huang et al. [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF], may improve this model. To achieve this goal, we consider a simple version, referred to as QRH-I, of the general model described by [START_REF] Abergel | Limit order books[END_REF] where the Hawkes kernels do not depend on the queue sizes and the various queues are considered as independent. In a second part, we consider a queue state dependent version of level-I LOB Hawkes model introduced by Bacry et al. [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF] where we account for bid and ask queue interactions and we suppose that both exogenous intensity and interaction kernel matrix share the same multiplicative queue dependencies. We call this model the QRH-II order book model. By calibrating these models using high frequency data from Eurex future markets, we show that both models achieve a better fit of the data than their pure queue reactive or Hawkes restrictions. Let us emphasize that, like the QR model of [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF], the QRH-I model can be considered as a model for both the order flow and the queue state whereas, within the QRH-II model, our main concern will be to improve the order flow description, in particular we will consider the queue as an exogenous imput.

The rest of paper is organized as follows. In Section 2 we elaborate on the QRH-I model, i.e. on a single-queue model that consists in adding an order flow dependence as provided by a multivariate Hawkes process to the Queue Reactive (QR) model introduced in [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF]. We show how such a model can be calibrated using a maximum likelihood approach and prove that, very much like the QR model, under some reasonable assumption, the queue size admits an invariant distribution. We then compare the likelihood of QRH-I model with both a standard Hawkes model with no state-dependence and with the model of [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF] on real data form the Eurex exchange. Comparisons with empirical data show that QRH-I model represents an important improvement of the QR model not only with respect to the interevent time statistics buy also regarding the predicted shape of the equilibrium queue size distribution.

In Section 3, we start instead from the point of view of level-I book model of [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF], that is a multivariate As mentioned in the introduction, Huang, Lehalle and Rosenbaum present, in [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF], a model where the order flow arrival at a given price level is modeled as an inhomogeneous Poisson process with an intensity that depends only on the current state of the order book and in particular on the queue sizes. They name this property Queue Reactive (QR). Let us briefly recall here the main lines of the QR approach which will be shared by our model. The order book is seen as a 2K-dimensional vector, where K represents the number of available levels on each side, the prices living on a grid whose resolution is the tick size tick, i.e., the unit of price variations. The bid and ask sides are separated by a reference price p ref which is equal to the midprice p mid (i.e., the mean value of best bid and best ask prices) if the spread is an odd multiple of the tick size and equal to p mid ± tick 2 , whichever is closer to the previous p ref , if the spread is an even multiple of the tick size. The price levels on the bid side are denoted as {Q -i } i=1...K , those at the ask side as {Q i } i=1...K while the quantities available at these levels by q ±i . The queue sizes are modified by the arrival of limit, market and cancel orders. For the sake of simplicity, all orders are assumed of unitary volume, so a limit order adds one unit to the queue, while a market or a cancel order subtract one unit. We will denote by λ L i , λ M i and λ C i the arrival intensities of respectively limit, market and cancel orders on the queue i. In the simplest version of the QR model of Huang et al., all the queue sizes are independent one from each other and, for some given queue i, the intensity λ L i , λ M i and λ C i depends only on the queue size q i , namely:

λ L i (t) = µ L i (q i (t -)) λ C i (t) = µ C i (q i (t -)) λ M i (t) = µ M i (q i (t -)) (3)
where the functions {µ i (q)} i, are the parameters of the model. They correspond to the rates of a birthdeath Markov process and can easily be estimated via maximum likelihood which, in this case, amounts to the computation of conditional empirical means of intensities defined in [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF]. As the labeling of a price level is relative to the reference price, when p ref changes, the level labels also change. Hence, the estimation is performed on intervals where p ref is constant and each period is regarded as an independent realization of the process. As shown in [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF], the QR model and its extension accounting for the queue interactions is an ergodic continuous time jump Markov process provided the limit order rate is bounded for large queue sizes, and the rate at which orders are removed is larger than the rate which increases the queues. In that respect, the QR model represents a simple and parsimonious Markov model that allows one to account for the state dependent nature of the book dynamics and that is able to describe the (stationary) distribution of the queue sizes. Our goal is to consider an extension of Huang et al. QR model with independent queues that is able to account for both queue reactive and for the memory effects in the order flow. This can be done by combining the dependence on the current state of LOB with the one on past order flow events as given by a multivariate Hawkes process within a QRH model. Note that, as discussed in the introduction (Eq. ( 2)), in principle both Hawkes kernels and the baseline intensities could depend on the LOB state and indeed we will explore such a possibility in the next section. Here however we are interested in the simplest modification of the model of Huang et al. that accounts for the dependence on the past order flow. In that respect our model introduces state-dependence in the multivariate Hawkes framework by allowing exclusively exogenous intensities to depend on the queue size. Furthermore, since our database mainly concerns the best bid and ask, we consider only the positions Q ±1 . By bid-ask symmetry (supported by empirical observations), both processes can be assumed to have the same law and we will henceforth drop the subscript i. Accordingly, N L t , N C t , N M t , λ L (t), λ C (t) and λ M (t) will denote the counting processes and their associated intensities defined by the arrivals of respectively limit, cancel and market orders at best bid (or alternatively at best ask). We refer to this variant of the QRH model as the QRH-I model since it mainly concerns a single LOB queue (at best bid or best ask). For , m ∈ {L, M, C} (for respectively limit, market and cancel orders), the QRH-I model thus defines λ (t) as:

λ (t) = µ (q(t -)) + m t 0 φ m (t -s)dN m s . (4)
where the queue size q(t) is simply q(t) = q(0)

+ N L t -N M t -N C t .
Since market and cancel orders can only be sent when the queue is non-empty, in the case when q(t) = 0, the previous expression should be replaced by λ (t) = 0 for = M, C. The baseline intensities {µ (q)} depend on the LOB state q while the Hawkes kernels φ m (t) account for the effect of past orders of type m occurrence on the current intensity λ (t). In full rigor, to complete the model definition, one should specify the law of the the initial queue size q(0). Since, has shown below, we will consider a situation when the queue process is a component of an ergodic vector Markov process, the choice of this law is not pertinent an we simply choose q(0) = 0. Let us note that the intensity function of the QR model (with independent queues) and the one of a standard Hawkes model could both be treated as a special case of the intensity function of QRH-I model. One recovers the QR model when the Hawkes kernels are zero and a standard multivariate Hawkes model for constant baseline intensities. We proceed as in [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF] and we assume that the model (4) holds in periods when the reference price is constant, and furthermore that such periods can be considered as independent realizations. Note that by doing so we reset the Hawkes memory every time there is a change in the reference price. We will discuss this point below when analyzing the empirical results and we will drop this assumption in the model we present in Section 3. The model parameters can be estimated using the maximum likelihood method. The log-likelihood L of a D-dimensional point process where the components do not share any parameters has the following general form (see [START_REF] Daley | An introduction to the theory of point processes: Elementary theory and methods[END_REF], page 21)

L(θ) = D =1 L (θ), with L (θ) = T 0 log λ (t; θ|F t )dN t - T 0 λ (t; θ|F t )dt ( 5
)
where θ denotes the parameter set and λ is the intensity function of the -th component.

To use the method in practice, a parametric form must be specified for the interaction kernels φ m in Eq. (4). A standard choice is to consider that φ m can be written as sum of exponential kernels:

φ m (t) = U u=1 α m u β u e -βu(t-s) (6)
where α m u are parameters of the model and β u , U are suitably chosen hyper-parameters. This choice also presents the important advantage that the resulting log-likelihood is a convex function of the model parameters. To faciliate the notation, we use µ and α to represent all µ and α m u . With such parametriza-tion, θ = ( µ, α).The log-likelihood of the QRH-I model (4) thus reads:

L(θ) = D =1 N k=1 log µ (q(t k )) + D m=1 U u=1 α m u β u t 0 e -βu(t-s) dN m s - D =1 T 0 µ (q(s)) + D m=1 U u=1 α m u β u s 0 e -βu(s-v) dN m v ds (7)
As we show in Appendix A.2, the specific choice of a sum of exponential functions (Eq. ( 6)) allows for a computationally efficient calculation of the log-likelihood and of its gradient.

Another important advantage of the parametrization ( 6) is that it allows us to work within the framework of Markov processes. Let us note I = {C, M } the set of order types that decrease the queue size and J = {L} the set of order types that increase the queue size. The queue size q(t) thus simply corresponds to:

q(t) = m∈J N m t - ∈I N t . (8)
If one defines

o mu (t) = t 0 α m u e -βu(t-s) dN m s , (9)
and denote by o(t) the vector obtained by a vertical stacking of o mu (t) (u ∈ {1, . . . , U }, , m ∈ {L, M, C}), then q(t) -→ o (t) is vector Markov process. This property can be proved exactly along the same lines as in Proposition 2.2 of [START_REF] Jedidi | On the stability and price scaling limit of a hawkes process-based order book model[END_REF]. Moreover, if one assumes that ∈I µ (q) ≥ c q and µ m (q) ≤ c * , ∀m ∈ J , we show, in Appendix A.1, with the help of Lyapunov functions approach, that the process q(t)

- → o (t)
is V-uniformly ergodic which notably means that q(t) admits an invariant distribution and that this equilibrium is reached exponentially fast.

Calibration results

Data In this study we use tick by tick level L1 data of Bund future and DAX index future traded on the Eurex electronic future market. The data span the period from October 1st 2013 to September 30th 2014. The dataset consists in snapshots of the first level of the order book, each with a timestamp indicating the record time with microsecond precision, that provide prices and outstanding quantities. Every time a trade occurs a specific line is added to the dataset, thus allowing to precisely determine the type of order (i.e. limit order, cancellation, or market order1 ) that lead to a change in the LOB. The Eurex future market is open from 8 a.m. to 10 p.m., Frankfurt time, however thorough this paper we only consider the time slot from 9 a.m. to 9 p.m. in order to capture the most active period. In Table 1, we report some descriptive statistics of our datasets. We note that, from the micro-structural point of view, the Bund future can be considered as a large tick asset, with and average spread very close to one, while the DAX has a considerably smaller perceived tick size compared to the Bund. This difference at the market microstructure level will reflect also in the queue dynamics and in the result of our model. Indeed, the queues on the Bund are often large as the midprice stays constant for relatively long periods of time while bids/offers accumulate at the best quotes, while on the other hand on the DAX the midprice changes more frequently thus resulting in slimmer queues at the best quotes. Further details on the datasets as well as a more detailed description of the inter-event time distribution can be found in [START_REF] Rambaldi | The role of volume in order book dynamics: a multivariate hawkes process analysis[END_REF]. Let us emphasize that since in our setting the order book is seen as a collection of independent queues, we impose a priori a strict bid-ask symmetry and all the results presented in Sec. 2 correspond to averaging estimations obtained on the bid and ask sides. Table 1: Descriptive statistics of our dataset. Average number of limit, cancel and market order at the best quotes per day. Average and median spread (measured in ticks) and average order sizes expressed in contracts.

# L # C # M Avg.
Estimation and goodness-of-fit analysis In order to estimate the parameters of our model, for each day in our sample we first compute the reference price p ref as specified at the beginning of this section. Then we determine the queue sizes, as in [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF], we assume that orders sizes for all events is a constant corresponding to the average event size (AES), defined as the average volume of all types of orders arriving at Q ±1 . We therefore measure the queue q in units of AES as

q(t) = v(t) AES ( 10
)
where is the ceiling function and v(t) is the volume available at time t in the queue. In Figure 1 we show the empirical distribution of the so-defined q(t) for Bund (left panel) and DAX (right panel). These distributions are obtained by sampling the book state every 30s over the whole time period. Notice that the state q(t) is set to 0 if and only if v(t) = 0. We observe that the Bund future presents a broader and smoother distribution as compared to the one of the DAX, which is on the contrary more concentrated on small queue sizes. This is a direct consequence of the different perceived tick sizes as we observed above. Once p ref , Q ±1 , and q ±1 are determined, we divide each day in periods where p ref is constant. Then, each period is considered as an independent sample and we determine the parameters of our model by numerically optimizing the joint log-likelihood over all the so-obtained independent samples. In total, we have 1, 207, 099 periods for the Bund and 417, 581 for the DAX. Notice that statistical estimation purpose, in the results reported below we considered only samples that contain at least a total of 20 events and disregarded the other ones. Notice that if s k stands for the length of the realization k and k t the index of the realization located around time t, the quantity

τ m = E s 2 k E [s k ]
represents the average length of the realization k t if one chooses t at random (i.e. with a uniform probability). This quantity is pertinent when performing averages over a fixed grid of times {t j } j . For the Bund we have τ m 100 s while for the DAX we estimated τ m 16 s.

As we pointed out above, in order to estimate our model we need to fix the number of exponential decays U as well as the values of the decays β themselves. We take U = 3 and we set β 1 = 60s -1 , β 2 = 1500s -1 , β 3 = 5500s -1 for the Bund and

β 1 = 40s -1 , β 2 = 2100s -1 , β 3 = 5200s
H 0 = QR, H 1 = QRH 1.8 • 10 7 27 < 10 -16
Table 3: Likelihood ratio test statistic and p-values for the case where the null hypothesis is the QR model and for the case where the null hypothesis is a standard Hawkes model. The "degree of freedom" ("df") value indicates the difference in the number of parameters between the two models.

with several combinations of U and β and we found these ones to represent a good compromise between the total number of parameters to estimate (the number of parameters α grows linearly with U ) and the model goodness of fit as measured by (penalized) log-likelihood.

The maximum likelihood allows us to perform a quantitative comparison of the QR and QRH-I models in terms of goodness of fit, which is one of the central results of this paper. For completeness we also consider a standard Hawkes model, i.e. with no dependence on the queue state. In Table 2 we report the log-likelihood values for the three models as well as the Akaike Information Criterion (AIC) score

AIC = 2k -2L (11)
and the Schwartz information criterion (BIC) score

BIC = k log N -2L ( 12
)
where k is the number of parameters, L is the log-likelihood and N is the total sample size (number of events in our case). These scores allow one to compare nested models by their likelihood while taking into account the different number of parameters (lower score is better). By looking at the values reported in Table 2, we observe that the QRH-I model has better scores in terms of AIC and BIC for both assets. We can also use the likelihood ratio test in order to compare the models. Indeed the QRH-I model reduces to the QR model when all the α are set tot zero. Likewise, the QRH-I model reduces to a standard Hawkes model when, ∀ , µ (q) = µ , i.e the dependence on the queue state is dropped. We report the test statistics LR = 2(L( θ1 ) -L( θ0 )) [START_REF] Martin D Gould | Limit order books[END_REF] where θ1 and θ0 are the maximum likelihood estimates for the null and for the alternative model respectively, and p-values for the likelihood ratio test in Table 3. We note that both the QR and the Hawkes model are rejected with a very high degree of significance when compared to the QRH-I model.

To complete the goodness-of-fit comparison of the models, we look at the inter-event time distribution. In particular, in Figure 2 we compare by means of a quantile-quantile plot the empirical inter-event times distribution with the ones produced by simulations of the calibrated QR and QRH-I models. It is clear from the figure that the QRH-I model reproduces strikingly better the empirical inter-event distribution, indicating that including the dependence on the past event is crucial in order to build a faithful model for the order flow fluctuations. The results presented in this section suggest that both LOB-state dependence and memory effects due to correlation in the order flow are relevant variables that need to be taken into account in order to build a faithful model for the order book dynamics. Crucially, adding a order flow dependence in the form of a Hawkes term dramatically increases the model likelihood as well as its capability of reproducing the observed inter-event time distribution.

State dependency and Hawkes matrix empirical estimations

In Figure 3 we report the estimated parameters µ(q) for the QR model, while in Figure 4 we plot the analogous quantities for the QRH-I model [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF]. We can make two general remarks while comparing these plots. First, we note that the dependence on the queue size captured by the two models are roughly concordant, in that functions µ (q) have similar shapes in both models. However let us remark that the values estimated within the QRH-I model are much smaller, indicating that a large part of the intensity is now explained by the self-and cross-exciting Hawkes components (see the discussion below). One can notice some differences between the Bund and DAX results, most likely stemming from the different order book dynamics typical of large and small tick assets respectively. As in [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF], we observe a decreasing rate of Market orders arrivals as the queue size increases. This can be explained by the fact that agents tend to consume liquidity faster as this liquidity becomes rare. We also find that, when, q(t) is large enough, the rate of cancellation is an increasing function of the queue size. This is an expected feature assumed in most former LOB models (see e.g., [START_REF] Smith | Statistical theory of the continuous double auction[END_REF][START_REF] Cont | A stochastic model for order book dynamics[END_REF]), since cancellations are more likely to occur when they are many active limit orders. As shown in Appendix A.1, this behavior ensures the ergodicity of the queue process. Let us finally notice, that unlike the observed behavior in [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF] on specific stocks, we don't observe that the intensity of limit order insertion is almost independent of the queue size. It is rather a decreasing function of the queue size probably reflecting a lesser quest for priority when q is large. It is also interesting to look at the quantity

e (q) = 1 - µ (q) Λ (q) ( 14
)
where

Λ (q) = E λ (t)|q(t -) = q (15)
is the average intensity in a given state q. e (q) corresponds to the fraction of the total average intensity explained by the endogenous self-and cross-exciting mechanism as a function of the queue size q, While Λ (q), in the case of the QR model, is directly provided by the parameter µ (q), for the QRH-I model it is given by the contribution of both the baseline intensity µ (q) and the Hawkes interactions. Unlike standard multivariate Hawkes processes, the QRH-I model does not admit a closed form formula of Λ (q) from its parameters. Therefore, while e (q) is trivially zero for the QR model, we resort to numerical computation of Λ (q) in order to compute e (q) for the QRH-I model. The result are shown in Figure 5, where we have plotted the estimated e (q) for all types of orders and for both the Bund (top panels) and the DAX (bottom panels) futures. Overall we see that a large part, from 60% to 80%, of the total average intensity is explained by the self-and cross-exciting effect. We note that for cancel and market orders, the intensity is maximally explained by the Hawkes term when the queue is small. This is likely to result from the persistence in the order flow and in particular of the relevance of the self-exciting term as we noted in Figure 6, which in case of market and cancel orders tends to empty the queue. This explanation is corroborated by the observation that the opposite effect is found for limit orders, namely an higher endogeneity for higher values of q.

To complete the analysis of the QRH model results, in Figure 6 we plot in a color map the Hawkes kernel norms |φ m | = ∞ 0 φ m (t)dt. Note that in our setting these quantities are simply given by |φ m | = U u=1 α m u . As discussed in [START_REF] Bacry | Hawkes processes in finance[END_REF], these quantities represent the average direct effect of an event of type m (columns) over the intensity of type (rows) events. Hawkes kernel matrices of order book events have been extensively studied in [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF][START_REF] Rambaldi | The role of volume in order book dynamics: a multivariate hawkes process analysis[END_REF]. Here, we note that despite the addition of the queue-dependent term, we recover many of the features already observed in previous studies, such as the strong diagonal component corresponding to self-excitation, likely the result of correlation in the order flow induced by order splitting strategies. We also confirm that market orders influence liquidity much more than the opposite effect. In particular, since here we look at interaction on the same side of the book, we note that market order have on average an exciting effect on cancellations. As observed in the aforementioned studies, a flow of market order at a given price signals that the "true" price is closer to that side and therefore liquidity adapts, with outstanding orders being canceled in order not to be adversely selected.

Equilibrium and empirical queue size distributions In Ref. [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF], the authors emphasized that the QR model provides a simple framework to account for the observed queue size distributions in the order book. For that purpose they have shown that the model invariant distribution fits quite well the empirical laws notably at the first bid/ask levels. In Appendix A.1, we show that, under some conditions that appear to be empirically fulfilled, the QRH-I model is also an ergodic process and the queue size can thus be described by its invariant distribution. Before comparing the performances of QR and QRH-I models with respect to their prediction of the equilibrium queue size distribution, let us emphasize that some caution is needed when addressing this issue. Indeed, this distribution, even if reached exponentially fast, does necessarily correspond to the empirically observed queue law since when the queue is empty, the reference price has a non-vanishing probability to change. This directly implies that for small values of the queue size, the invariant distribution is not supposed to account for the observed values from snapshots of the empirical book state. Moreover, since the initial queue size has no reason to be drawn with the invariant distribution, this law is pertinent only after a short delay that has to be compared to the length of each realization, i.e., the time period between two changes of reference price. The exponential rate involved in the ergodic theorem is however hard to estimate, one can use a proxy as given for example by the exponential decay of empirical queue size autocorrelation function. That is an alternative measure of a mixing coefficient that can be, under some conditions, related to the distribution relaxation time [START_REF] Bradley | Basic properties of strong mixing conditions. a survey and some open questions[END_REF]. If one assumes that the decay of autocorrelation of the queue size takes the form ρ(t) = a exp -t/τc , we find empirically that τ c 15 s for the Bund future and τ c 2 s for the DAX. For both assets these correlation characteristic scales have to be compared with the average realization length, namely τ m 100 s for the Bund and τ m 16s for the DAX. Since in both cases we have τ c τ m , it is likely that the invariant distribution is pertinent to account for the queue size distribution as observed at randomly chosen times. With previous observations in mind, we now proceed at the comparison of the empirical queue distribution, measured by taking snapshots of the book every 30s and the invariant distributions produced by the QR and QRH-I models. Since we do not have any explicit formula for the QRH-I model, we estimate the invariant distribution of q(t) by performing a simulation over a long time period. The invariant measure of the the QR model can be directly deduced from the estimations of µ (q) in Figure 3 using the analytical formula in Sec. 2.3.3 of Ref. [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF]. The plots the both QR and QRH-I invariant measures together with the empirical queue size distribution for both Bund and DAX are reported in Figure 7. First of all, we observe that the QRH-I model provides in both cases of better fit of empirical data, notably in the tail region, than the QR model. The latter is particularly far from the observed distribution in the large tick case of the Bund data. Its performance for the smaller tick asset (DAX) are closer to the results reported in [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF] for stock data. Beyond the fact that this striking difference between large and small tick assets is hard to explain (though the analytical formula in [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF] shows that the overall shape of the distribution can vary quite drastically when on changes the respective behavior of the µ (q) functions) our findings show that accounting for the Hawkes self-interaction within a queue reactive model is important not only to describe correctly the order flow dynamics but also provides a better model for the queue size distributions. We notice furthermore that the distribution of queue size simulated by QRH-I model deviates from the empirical distribution especially around states when the queue is small. As discussed previously, when the queue is empty, the reference price has a large probability to change and therefore the corresponding empirical sample to stop. This results in a statistical bias with respect to the "theoretical model" where such event type does not exist since when the queues empty nothing happens until a new limit order arrives. The states with a low queue values are therefore more likely to be visited in the model than in empirical observations.

A Queue Reactive Hawkes model for the best limits of the orderbook

In the previous Section, we presented a model for a single best limit with a fixed price, i.e., the model is reset when the price of the best limit changes. Thus, it does not account for the cross dynamic between the two best limits (best bid/best ask) nor it accounts for the changes of their corresponding price. This Section is devoted to a model that tackles these drawbacks. Both best limits are modeled along with mid-price changes. Hence, contrarily to the previous model (and also to the models presented in [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF]), resetting of the model only occurs at market close time. This new model is built by adding a queuedependency to the model of Bacry et al. [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF]. The model of the previous section was referred to as QRH-I (one-side LOB modeling), this new model will be referred to as QRH-II (two-side LOB modeling).

The QRH-II model : Adding queue-dependence to Bacry et al.'s model

In [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF] the authors consider eight event types at the best level of a LOB, namely P + (P -) for events that moves the midprice2 up (down) independently on the size of this move, L a (L b ) for limit orders at the best ask (bid) that do not change the midprice, C a (C b ) for cancellations at the best ask (bid) that do not change the midprice, M a (M b ) for market orders at the best ask (bid) that do not change the midprice, where, for any ∈ {P + , P -, L a , L b , C a , C b , M a , M b }, the best ask (resp. bid) level refers to the first non empty level on the ask (resp. bid) side. Let us define N t as the counting process associated with events to type and λ (t) the associated conditional intensity. Let us point out that that this description of the first limits of the LOB is significantly different from the approach taken in the previous section or in [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF] in which the best limit queue size can be 0. Also, this model no longer needs to be reset regularly and does not use any notion of reference price p ref .

The authors in [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF] consider a multivariate Hawkes model where each event type can influence, and be influenced by, the others so that the conditional intensities read:

λ (t) = µ + m t 0 φ m (t -s)dN m s , (16)
where and m can take any value among the 8 values

{P + , P -, L a , L b , C a , C b , M a , M b }.
In their work the kernels φ are estimated using the non parametric estimation method first described in [START_REF] Bacry | First-and second-order statistics characterization of hawkes processes and non-parametric estimation[END_REF]. This model allows the authors to highlight the rich influence structure between events in a limit order book, including the high-frequency midprice reversion and the persistent autocorrelation in the order flow determined by order splitting strategies but also some more refined market-maker induced dynamics (see [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF]).

In order to add queue-dependency to the previous Hawkes approach, we proceed in much the same way as we did in the previous section except that the order book state is no longer represented by a single queue quantity q (that represented either the best ask or the best bid quantity) but by both the best bid and the best ask queue sizes (q a , q b ). Let us point out that now the queue sizes q a and q b , by definition, never reach zero, moreover each process dN encodes the full history of all the events of type happening at the corresponding best side, independently of the various moves of the best ask/bid prices. So adding queue-dependency to such a model calls for a mechanism that is able to modulate (as a function of the orderbook state) not only the exogenous intensity µ (as in the previous model) but also the Hawkes part of the intensity. To illustrate that point, we can mention a situation where obviously the Hawkes kernel matrix should explicitely depend on the queue states: This is for instance the case of P + events which are very unlikely to occur (for a large tick asset) when the ask queue is big and the bid queue is small. We consider the simplest possibility where both the exogenous and the self-exciting part of the intensity share the same multiplicative dependence on the states and introduce the following model, referred to in the following as QRH-II

λ (t) = f (q a (t), q b (t)) µ + m t 0 φ m (t -s)dN m s , ( 17
)
where the functions f that encode the dependence on the orderbook states, modulate not only the exogenous intensity (as in Eq. ( 4)) but also the Hawkes term. Let us notice that unlike QRH-I model, the QRH-II model is mainly a model for the order flow, so we disregard the relationship between the order arrivals and the queue sizes and consider these queues as (observable) exogenous processes. As before, we choose a parametric form for the kernels φ m and in particular we adopt the same exponential-sum specification as provided in Eq. ( 6).

From log-likelihood estimation to least square estimation

Once the parametric form (6) for the kernels has been specified, the model can be estimated using MLE. Although the QRH-II model slightly differs from the QRH-I model, the calculation of its log likelihood function and its gradients follows the same track presented in Appendix A.2, with only a trivial modification required. Moreover, thanks to the chosen parametrization, the log-likelihood is again a convex function of the parameters, thus guaranteeing the existence of a global optimum. Since the number of configurations of the orderbook states grows quadratically in the number of states considered per-side, this can become problematic if this number is too large. Considering every possible state (i.e., every possible values for each queue) would require very long computation times. To limit the number of configurations, we thus consider the orderbook to be in state (q i a , q j b ) if the bid queue size is within its i-th quintile (i.e. the 25 • i percentile) and the ask queue is in its j-th quintile. So the estimated function f is actually a function of the quintiles f (q i a , q j b ). Finally, we choose the normalization (note that any other normalization would be equivalent up to a rescaling of the kernels and of the µ in Eq. ( 17))

f (q 1 a , q 1 b ) = 1. ( 18
)
Using maximum likelihood, we calibrate the so-obtained model on the same dataset used in the previous section. As shown in Tables 4 and5, our model outperforms in terms of goodness of fit the pure-Hawkes model introduced in [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF] when calibrated with sum of exponential kernels. In particular, a likelihood ratio test rejects the null hypothesis of a pure-Hawkes model with a p-value < 10 Table 5: Likelihood ratio test statistic and p-values for the case where the null hypothesis is the QRH-II model (defined by [START_REF] Jedidi | On the stability and price scaling limit of a hawkes process-based order book model[END_REF]) and for the case where the null hypothesis is the Hawkes model (defined in [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF]). A detailed discussion on the so-obtained MLE results will be made in Section 3.3. For now, for the sake of simplicity, let us first put apart the effect of the queue dependency and just look at the kernel estimation. Figure 8 represents the so-obtained kernel norm matrices { φ m (t)dt} m given by our model. This figure has to be compared with the matrix obtained in Figure 4 of [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF] for which the same model (without queue dependency) has been used. Let us point out that in order to obtain this matrix, [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF] performed a nonparametric estimation which allows negative values for the kernels and consequently negative values for some elements of the matrix { φ m (t)dt} m . These negative values account for inhibition dynamics, i.e., decreasing the intensity of a given type of event. One could show that negative values for a kernel could lead at a finite time (and with a non zero probability) to some situation where the sum ( 17) is negative leading to a negative intensity which, of course, does not make any sense. In order to circumvent this difficulty, it is common to replace equation ( 17) by a non-linear equation of the form

P + P M a M b L a L b C a C b P + P M a M b L a L b
λ (t) = f (q a (t), q b (t)) µ + m t 0 φ m (t -s)dN m s + , (19)
where the operator (. . .) + does not change the value of the quantity in between the parenthesis in the case this quantity is positive and is 0 if this quantity is negative. However, in the framework of this non linear Hawkes model, MLE becomes intractable since it is no longer a convex problem. As explained in [START_REF] Hansen | lasso and probabilistic inequalities for multivariate point-processes[END_REF], this problem is tractable in some sense when considering the least square approach (see also [START_REF] Rambaldi | Disentangling and quantifying market participant volatility contributions[END_REF] for example of least square estimation with negative valued kernels). Thus, the least square estimations allows negative valued kernels whereas, in the MLE framework as presented above, we forced all the kernels (i.e., all the α lm u 's in Eq. ( 6)) to be positive valued. This mainly explains the differences found between Figure 4 in [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF] and our Figure 8. For the sake of just naming one striking difference, in [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF], the kernel integral φ L b P -(resp. φ L a P + ) is found to be strongly negative. Actually, as seen in Appendix B.6 in [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF], the kernel itself φ L b P -(resp. φ L a P + ) is mostly negative at all time scales. This fact can be seen as a natural dynamic induced by market makers: when the price goes down, the efficient price is closer to the best bid price thus less limit orders are placed on the bid size (the gain is small compared to sending an aggressive order) and more limit orders are placed on the ask side. Let us point out that forcing the kernels to have only positive values (i.e., forcing all the α lm u to be positive as assumed when performing MLE) will a priori not only lead to highly biased values for kernels with negative values but is likely also to induce high bias for kernel with only positive values since the estimation performed is a joint estimation of all the kernels involving intricate relationships between these kernels (see [START_REF] Bacry | First-and second-order statistics characterization of hawkes processes and non-parametric estimation[END_REF] for examples of such biases). Consequently, it appears that one should use least square based estimation rather than MLE. Details about least square estimation can be found in Appendix A.3. It consists in minimizing R(θ) as defined by

R(θ) = D =1 R (θ), with R (θ) = T 0 λ 2 (t; θ|F t )dt - N k=1 λ (t k ; θ|F t k ) ( 20
)
where λ is given by Eq. 17 3 . One could easily verify that this problem is convex as a function of the α u lm (see Eq. ( 6)), thus the existence of a global optimum is guaranteed. As shown in Appendix A.3, this parametrization allows a computationally efficient calculation of the squares loss function R together with its gradient.

Fitting results and comments

In this section we present and comment the results obtained through least square estimation of the QRH-II model as defined by Eq. ( 17).

Estimation of the f (q a , q b ) functions. In our results we document a clear dependence of the order arrival rates on both q i a and q j b , indicating that the state of the LOB has a clear influence on the order arrival rates. Let us point out that previous works (e.g., [START_REF] Rambaldi | The role of volume in order book dynamics: a multivariate hawkes process analysis[END_REF] and [START_REF] Lehalle | Optimal liquidity-based trading tactics[END_REF]) suggest that this dependence is actually a dependence on the imbalance of the queue sizes as defined by

I(t) = v b (t) -v a (t) v b (t) + v a (t) = q b (t) -q a (t) q b (t) + q a (t) (21)
where v a/b (t) denote the volume available at time t at best ask/bid prices and we have assumed that orders have a constant volume corresponding to the AES as defined previously. The imbalance represents the simplest proxy to account for the instantaneous buying pressure. In that respect, in Figures 9 and 10 we plot the parameters f (q i a , q j b ), in logarithmic scale, for each order type as a function of the imbalance I calculated as the median imbalance in the state interval associated with quantiles (q i a , q j b ). Let us note that in these plots, the dot sizes indicate the sizes of the corresponding q i b . By looking at Figures 9 and 10 we can make the following observations: First, the variation of the imbalance on the order book captures most of the variations of the intensive parameters f (q a , q b ), this is more evident on the large tick asset (Bund) for which f can span almost three order of magnitudes (for P , and M events) as I ranges from -1 to +1. The variations of f (q a , q b ) are smaller for the small tick asset (DAX) so the effect of the imbalance is less pronounced albeit still visible for P and to a lesser extent L events. This is in line with the observation that the imbalance is a very good predictor for midprice changes for large tick assets while its predictive power is less marked for small tick ones (see e.g. [START_REF] Martin | Queue imbalance as a one-tick-ahead price predictor in a limit order book[END_REF]). One aspect to keep in mind while analyzing these figures is that, especially for a small tick asset, there is also a considerable amount of information in the deeper levels of the book that is not taken into account here. In Figure 9 corresponding to the Bund results, we observe that for midprice changes (P events) there seems to be a kind of threshold effect, in that for imbalance values below I = -1/2, upwards price increments are dramatically inhibited, while large positive imbalance only marginally increases the likelihood of upwards price changes. This is rather natural since an imbalance smaller than -1/2 corresponds to the case the ask size is at least three times bigger than the bid size which makes upwards move of the midprice very unlikely. More surprinsingly, the agents seem to strongly condition their decision to use aggressive orders (M events) on the state of the order book. Maybe they rush to get last available liquidity before an upwards midprice move (indeed f gets very large for M events when the imbalance is large, i.e., when there is hardly anything left on the ask size). Limit and Cancel orders appear to be much less sensitive to the state of the book. For the DAX, as we already pointed out, the dependence on the imbalance is much less pronounced (see Figure 10) and, expcept the mid-price changes, all factor f (q a , q b ) are weaky varying with I. Notice hower that for market (M ) and cancel (C) orders we observe a regime switching around I = 1/2. These regimes correspond respectively to quite large and very small ask queue size. In the latter case (that turns out to occur when the spread equals one tick) the occurence of market and cancel orders at ask that do not change the midprice is very unlikely. Last but not least, let us remark that the intensity variations that are not captured by the imbalance are mainly located around I = 0 where the individual queue sizes (q a or q b which are almost equal) seem to have an important impact. Thus, for instance, for the Bund, f P + (q, q) seems to increase with q. Actually, this can be explained by a more thorough analysis that shows that the average spread is increasing with q and is very close to 2 when q is large. The same kind of remarks could be done for market orders. a , q j b )) for l = P + , L a , C a , M a of QRH model as a function of the imbalance 21, Bund future. The quantiles are the same for bid and ask sides and correspond to q 1 a = q 1 b =]0, 80], q 2 a = q 2 b =]80, 165], q 3 a = q 3 b =]165, 258], q 4 a = q 4 b =]258, 386] and q 5 a = q 5 b =]386, +∞[.

As this example illustrates other microstructural variables and notably the spread, should be taken into account for an even more complete model. This however is outside the scope of the present work.

Comparison of estimated and empirical intensity. To further validate the QRH-II model, we test its ability to reproduce the empirical intensity. The MLE of the averaged intensity conditioned by the state q = (q a , q b ) 15 writes (in a non parametric framework)

Λ (q) = Λ(q) t k 1 q(t l- k )=q t k 1 q(t - k )=q with Λ(q) = mean(t k -t k-1 |q(t - k ) = q) -1 , (22)
where the operator mean(. . .) corresponds to the empirical mean. This estimation is simply based on the observations of the process {N l t } l . One can compute a corresponding estimator Λ QRH-II (q) using QRH-II parametric form of λ QRH-II (t ,- k |q), this leads to

Λ QRH (q) = mean( λ QRH-II (t ,- k )|q(t ,- k ) = q) (23)
In order to synthesize the so-obtained results, we choose not to present the comparison of Λ QRH-II (q) with Λ (q) for all types of orders and for all states q. Instead, for each type of order, we report the weighted relative error ∆ defined as:

∆ = q Λ (q) -Λ QRH-II (q) N (q) q Λ (q)N (q) (24)
The weighted relative error for Bund and DAX is presented in table 6. We observe that ∆ are of the order of 10%, which provides a satisfactory match to the empirically observed intensity. a , q j b )) for l = P + , L a , C a , M a of QRH model as a function of the imbalance 21, DAX index future. The quantiles are the same for bid and ask sides and correspond to q

1 a = q 1 b =]0, 2], q 2 a = q 2 b =]2, 3], q 3 a = q 3 b =]3, 5], q 4 a = q 4 b =]5, 8
] and q 5 a = q 5 b = [8, +∞[. Analysis of the kernel norm matrices. Finally, to complete the analysis of our results, in Figure 11 we display the matrices of the estimated norms { φ m (t)dt} m for both the Bund and the DAX. These matrices provide information on the average interactions between different event types when queue dependence is disregarded. As such they are the counterpart of the kernel norm matrices shown in Figure 4 of [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF]. We recover a lot of the features highlighted in [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF], such as the strong diagonal components for limit, market and cancel orders (a signature of order splitting), as well as the fact that market orders and price movement appear to influence much more limit and cancel than the other way round. Notably, for the Bund, when the midprice moves up (resp. down) it decreases (resp. increases) the rate of limit orders on the ask (resp. best) side since the efficient price is close to the best ask, there is no gain to send a limit versus a market. This also explains why it increases (resp. decreases) the rate of cancel orders sent on the best ask (resp. bid) side. The same effect can be more or less seen (but attenuated a lot) on the DAX. It is attenuated because the tick is small on the DAX, so the efficient price argument is not as strong. Let us point out that the exact same argument can be used to explain the effects of market orders on limit and cancel orders. The influence of market order over price change is mainly because that under our settings, market order consumes the liquidity at the best prices, which could eventually create a new price. Since DAX is a small tick asset and queue size at the best prices is smaller that Bund, market orders are more likely to generate new prices. So the influence of market order over price change is more visible. We can see that for DAX future, limit orders and cancellations also has stronger influence toward price changes, for the same reason. One can also see that, apart from the self-exciting effect due to splitting of orders, for the Bund, limit orders on one side are coupled with cancel orders on the other side. This can be seen as a simple market maker strategy (rebalancing of the position). It does not show on the DAX certainly because, since the tick size is much smaller, the same rebalancing strategy does not affect necessary both best sides. We refer the reader to [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF], Section 4 for further details on the interpretation of these features. Though for most features, QRH-II model (Figure 11) and the pure Hawkes model (Figure 4 in [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF])) are similar, we can however observe a striking difference in the P → P and P → T submatrices. We can notice in QRH-II the absence of a strong excitation between P + to P -and P -to P + (top left 2 × 2 submatrices in Figure 11) which should be the signature of the high frequency price mean reversion (as explained in [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF]). For a pure Hawkes processes model, like in work [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF], the mean-reversion of price is reflected on the strong anti-diagonal terms of the P → P kernel norms submatrix (i.e., strong P + → P - and P -→ P + terms). This results from the fact that (in average) a P + event will generate more P - events than P + events, and vice versa. As shown in table 7, the actual midprice series are strongly mean-reverting, so it is likely that, within the QRH-II model this feature should be explained by the queue-reactive function f (q a , q b ). Indeed, as illustrated in Fig. 12, after a midprice change the imbalance evolves in favor of a price move towards the opposite direction. For instance, an upward price jump P + leads, most of the time, to a negative imbalance either because of a refill of the best ask queue q a or simply because a single buy limit order is sent within the spread. According to results of Figs. 9 and 10, in this case we have f P + (q a , q b ) 1 and f P -(q a , q b ) > 1. Conversely, after a downward price change, P -, we will have f P -(q a , q b ) 1 and f P + (q a , q b ) > 1. The 2 × 2 submatrix P → P estimated within a pure Hawkes model is then likely to correspond to the QRH-II Hawkes submatrix multiplied by a large factor on its anti-diagonal and a small factor on its diagonal. The same kind of argument based on imbalance impact can be invoked to explain the high diagonal values of the P → T submatrix while the highest values in [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF] were rather observed on the anti-diagonal.

P + P - L a L b C a C b M a M b Bund
P + P M a M b L a L b C a C b P + P M a M b L a L b

Rate of mean-reversion

Summary and prospects

In this paper, we introduced two "Queue Reactive Hawkes models" (QRH-I and QRH-II) with the ambition to improve respectively the approach of Huang et al. [START_REF] Huang | Simulating and Analyzing Order Book Data: The Queue-Reactive Model[END_REF] on the queue reactive nature of the LOB dynamics and the model of Bacry et al. [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF]. We show that shuch models can be easily calibrated within a parametric approach. Our empirical findings on two different future asset from Eurex, namely Bund and DAX order book data, suggest that both queue reactive and past order flow dependencies are relevant to account for the occurrence likelihood of future order book events. Indeed, both models outperforms in terms of goodness of fit a pure Hawkes model as well as a pure queue-reactive one. As far as QRH-I model is concerned, our framework allows one to remain within the framework of Markov processes that has ergodic properties so, along the same line as in Huang et al. approach, we can define and estimate the queue size distribution associated with the invariant measure of the model. The QRH-II model lead us to refine Bacry et al. findings [START_REF] Bacry | Estimation of slowly decreasing Hawkes kernels: Application to high-frequency order book dynamics[END_REF] by accounting for the states of best bid and best ask queues. It turns out that the volume imbalance allows us to explain most of the queue dependence. The QRH-II model could be improved by accouting for the interactions between the queue sizes (and thus the imbalance) and the order flow, as in the QRH-I model and also to include an explicit dependence on the spread for small tick assets. Some substantial simplifications we made could also be removed in order to have a even more realistic model such as, for instance, dropping the assumption of unitary order sizes by adopting a similar approach to [START_REF] Lu | Order-book modelling and market making strategies[END_REF]. Besides considering various applications of these models to design and optimize high frequency trading strategies, from a numerical point of view, it remains to define approaches that allow one handle the full QR-model as defined in Eq. [START_REF] Abergel | Limit order books[END_REF] where not only the queue dependencies of the exogenous and Hawkes kernels are arbitrary but that simultaneously account for all the order book queues up to a given depth. Maybe some recent approaches and techniques developed in statistical learning would be helpful to handle such high dimensional problems. From a mathematical point of view, it remains to develop a deeper understanding of the stability and stationarity conditions for queue dependent Hawkes models. More fundamentally, a clear understanding to the observed shapes of the exogenous intensities and the imbalance dependence of the order flow arrival rates in term of the (rational) behavior of various market participants remain open questions. By adopting defintion ( 23) and ( 6), the intensity function now takes the form:

A Appendix

λ (t) = µ (q(t -)) + D m=1 U u=1 o mu (t) , (26)
up to an overall factor 1 q(t) =0 that has to be considered for orders that consume the queue size. We note J the set of order types that increase the queue size and I the set of order types that decrease the queue

A.1.2 Lyapunov function for q

Similarly, let us first write the differential form of q(t):

dq(t) = m∈J dN m t - ∈I dN t (35)
We keep using the same notation of ∆ as in Eq 29. For any arbitrary suitable function F who maps R + to R, the infinitesimal generator takes the form:

LF (q) = m λ m (F (q + ∆ m (q)) -F (q)) (36)

Next, we choose V 2 as the identity function of q:

V 2 (q) := q (37)

Then it could be easily verified that V 2 (q) is a Lyapunov function for q:

LV 2 (q) = m∈J λ m (q) - ∈I λ (q) ≤ m∈J µ m (q) - ∈I µ (q) + ,m,u o mu ≤ m∈J c * - ∈I c q + ,m,u o mu ≤ - ∈I c q + C 2 ≤ -ρ 2 V 2 + C 2 (38)
Remind that constants c * , c are defined before. The constant ρ 2 is simply chosen as ρ 2 = max c . Also, it must be noted that here The final step is to build a function V for both q and o:

V (q, o) = V 2 (q) + 1 η V 1 ( o) (41)
We then apply previous conclusions made for V 1 and V 2 . Direct calculation shows:

LV (q, o) = LV 2 (q) + 1 η LV 1 ( o) = -ρ 2 V 2 + C 2 - ρ 1 η V 1 + C 1 η ≤ -ρ 2 V 2 + ρ * ,m,u o mu - ρ 1 η V 1 + C (42)
Notice that since both the coefficient δ mu in V 1 and o mu are positive, there must exist an η who satisfies

ρ 1 2η V 1 ( o) > ρ * ,m,u o mu (43)

Figure 1 :

 1 Figure1: Empirical distribution of the queue states (measured in unit of AES) as defined in[START_REF] Daley | An introduction to the theory of point processes: Elementary theory and methods[END_REF]. Left: Bund future. Right: DAX future.

Figure 2 :

 2 Figure 2: Log qq-plot of inter-event times. Log of quantiles of inter-events times simulated by model (horizontal) is plotted against log of empirical quantiles (vertical). Left: Bund future. Right: DAX future.

Figure 3 :

 3 Figure3: From left to right: estimated values µ q for limit order insertion, limit order cancellation and market orders, QR model. Top row: Bund future. Bottom row: DAX future.

Figure 4 :

 4 Figure4: From left to right: estimated values µ q for limit order insertion, limit order cancellation and market orders, QRH model. Top row: Bund future. Bottom row: DAX future.

Figure 5 :

 5 Figure 5: From left to right: Endogenous fraction for limit order insertion, e (q) as defined in Eq. (14)), for limit ( = L), cancellation ( = C) and market ( = M ) orders by QRH model. Top row: Bund future. Bottom row: DAX future.

Figure 6 :

 6 Figure 6: Kernel norm matrices for Bund future (left) and DAX future (right).

Figure 7 :

 7 Figure 7: Comparison of the invariant distributions of the QR and QRH models with the empirical one. Left: Bund future. Right: DAX future.

  5.348 × 10 8 -1.070 × 10 9 -1.070 × 10 9 400 Hawkes 5.200 × 10 8 -1.040 × 10 9 -1.040 × 10 9 4.626 × 10 8 -9.253 × 10 8 -9.253 × 10 8 400 Hawkes 4.488 × 10 8 -8.976 × 10 8 -8.976 × 10 8 200 Table 4: Log-likelihood, AIC, and BIC values for the QRH-II model (defined by (17)) and the Hawkes model (defined in [4]) for Bund and DAX data. Bund LR df p-value H 0 = Hawkes, H 1 = QRH-II 2.9 • 10 7 200 < 10 -16 DAX LR df p-value H 0 = Hawkes, H 1 = QRH-II 2.8 • 10 7 200 < 10 -16

Figure 8 :

 8 Figure 8: MLE Kernel norm matrices φ lm (t)dt for Bund future (left) and DAX future (right) for the QRH-II model (defined by (17)).

Figure 9 :

 9 Figure9: From left to right, upside to downside, log 10 (f l (q i a , q j b )) for l = P + , L a , C a , M a of QRH model as a function of the imbalance 21, Bund future. The quantiles are the same for bid and ask sides and correspond to q 1 a = q 1 b =]0, 80], q 2 a = q 2 b =]80, 165], q 3 a = q 3 b =]165, 258], q 4 a = q 4 b =]258, 386] and q 5 a = q 5 b =]386, +∞[.

Figure 10 :

 10 Figure10: From left to right, upside to downside, log 10 (f l (q i a , q j b )) for l = P + , L a , C a , M a of QRH model as a function of the imbalance 21, DAX index future. The quantiles are the same for bid and ask sides and correspond to q1 a = q 1 b =]0, 2], q 2 a = q 2 b =]2, 3], q 3 a = q 3 b =]3, 5], q 4 a = q 4 b =]5, 8] and q 5 a = q 5 b = [8, +∞[.

Figure 11 :Figure 12 :

 1112 Figure 11: The estimated matrix norms φ lm (t)dt using least square estimation QRH-II model. Bund future on the left and DAX future on the right.

A. 1

 1 Proof of the existence of invariant distributionWe are motivated to prove the existence of invariant distribution of QRH-I model presented in Part I, for the reason that if such invariant distribution exists, we could approximate the empirical distribution of queue size by simulating the QRH-I model for a long time. The proof is made with the help of Lyapunov function. First let's define:

  o. Another remark is since m and c * are fixed, there must exist ρ * who satisfyC 2 < ρ * ,m,u o mu(40)A.1.3 Lyapunov function for (q, o)

  Hawkes model for all events occurring at the first level of the order book. The QRH-II model is defined by considering a multiplicative dependence of Hawkes kernel matrix and exogenous intensities on both the best bid and best ask queue states. We show that such a state dependence is a very meaningful assumption. The empirical results provided by the model calibration using Eurex future data are then discussed. Concluding remarks and prospects for future research are provided in Section 4. Technical results like the proof of the ergodicity of QRH-I, the model calibration issues by Maximum Likelihood or Least-Square approaches are given in the Appendices.

  spread Med. spread AES Med. inter-event time Bund 5.41 × 10 7 4.67 × 10 7 6.29 × 10 6 DAX 5.46 × 10 6 5.62 × 10 6 6.68 × 10 5

	1.012	1.0	6.34	4.89 × 10 -4
	1.591	2.0	1.30	1.73 × 10 -3

Table 2 :

 2 10 7 -4.093 × 10 7 -4.092 × 10 7 450 QRH 2.055 × 10 8 -4.110 × 10 8 -4.110 × 10 8 Log-likelihood, AIC, and BIC values for the three considered models for Bund and DAX data.

			Bund
		L	AIC	BIC	# parameters
	QR	2.046 × 477
			DAX
		L	AIC	BIC	# parameters
	QR	7.268 × 10 5 -1.453 × 10 6 -1.452 × 10 6	75
	QRH 9.506 × 10 6 -1.901 × 10 7 -1.901 × 10 7	102
			Bund
			Difference of log-likelihood df p-value
	H 0 = QR, H 1 = QRH	3.7 • 10 8		27 < 10 -16

-1

for the DAX. We experimented DAX Difference of log-likelihood df p-value

Table 6 :

 6 Error of average intensities by order type

		14.2% 10.5% 6.7% 6.0% 7.4% 8.1% 4.0% 12.0%
	DAX	8.2%	5.9% 0.5% 4.7% 7.1% 1.1% 1.6% 5.9%

Table 7 :

 7 Measure of mean-reversion of price: Empirical probabilities than two successive midprice change events have opposite directions.

	Bund	0.65
	DAX	0.56

With a slight abuse of language, in this paper we use the term "market order" to denote any order that immediately gives rise to a trade, regardless to whether or not it has a limit price.

We recall that the midprice corresponds to the average of the best ask price with the best bid price.

or alternatively by Eq[START_REF] Lu | Order-book modelling and market making strategies[END_REF] in the sense given in[START_REF] Hansen | lasso and probabilistic inequalities for multivariate point-processes[END_REF]

size. We further assume that ∈I µ (q) ≥ c q and µ m (q) ≤ c * , ∀m ∈ J. The queue size is determined by the sum of order flows:

Let o(t) be the vector obtained as a vertical stacking of the components o mu (t) for all ( , m, u) ∈ {1, . . . , D} 2 × {1, . . . U }. It is not difficult to verify that the vector process (q, o) T is Markovian. We then aim at constructing a Lyapunov function for (q, o) T . To start with, we construct Lyapunov functions for q and o seperately, then we combine them together.

A.1.1 Lyapunov function for o

Let us first write the differential form of o(t):

Then for any arbitrary suitable function F who maps R 2D+U to R, the infinitesimal generator takes the form:

Where λ m is the probability for an event to arrive in dimension m of the point process N , and ∆ m ( o) is jump of o caused by this event. We then define the matrix A as:

We assume that the dynamics of order flows described by the Hawkes part of the QRH-I model corresponds to a stable Hawkes process. According to Perron-Frobenius theorem, the maximal eigenvalue κ of A satisfies 0 < κ < 1, and the associated eigenvector of κ satisfies ∀l, l > 0. We then note

With notations defined above, we could then verify that

Where the constant ρ 1 is chosen as

By substituting this inequality into Eq 42, we finally prove that V is a Lyapunov function for (q, o):

Given the existence of the Lyapunov function and the geometric drift condition above, under the assumption that the spectral radius of A is smaller than one, Theorem 7.1 in [START_REF] Meyn | Stability of markovian processes iii: Foster-lyapunov criteria for continuous-time processes[END_REF] guarantees that the process q is ergodic. Also, it converges exponentially fast towards its unique stationary distribution.

A.2 Calculation of the log-likelihood function of QRH model and its gradient

For QRH model, the log-likelihood is a function of µ and α. Let's note t k the timestamp of the kth event of type , and N the total number of event of type . With such notation,

We first define g and G, whose value doesn't depend on the parameters µ and α. The interest is that g and G only need to be calculated once, then they could be reused to accelerate the calculation of log-likelihood function and its gradient.

And

Both g and G could be calculated using the following recurrence relation:

We will see later that we only need the value of g and G at for every t k .

A.2.1 Log-likelihood function

By exploiting the definition of g and G, the log-likelihood function could be rewritten in the following way:

A.2.2 Gradients

With a little abuse use of the symbol q and q(t), direct calculation shows that:

A.3 Calculating the least squares function of QRH model and its gradient

A.3.1 Least squares function

For the QRH model described in the Part II. Let's note q the state of the LOB by combining the state of both the ask side and the bide side. q = q a × q b f (q(t)) := f (q a (t -), q b (t -)) (56)

Then at time t, the intensity function of dimension is:

Similar to the calculation of log-likelihood funtion and its gradients, we first define some intermediate vairables whose value doesn't depend µ, α or f . They only need to be calculated once in the pre-processing stage. Then they could be reused during the calculation of least squares function and its gradient.

Computation of H

A.3.2 Least squares function

With the intermidiate variables defined in the previous part, we can rewrite the least squares function defined in 20 in a more efficient form for calculation. In dimension ,

Let's name the first item and the second item in the formula above term I and term II seperately. We could further decomposite term I into new items term I.1, term I.2 and etc:

For term I.1, it could be calculated from the intermediate variables defined above:

For term I.2,

And for term I.3,

For the convinience of notation, we flip the sign of term II. Then we decomposite it into term II.1 and term II.2 :

For term II.2, The least square function defined in 20 could be calculated by summing up all these terms.

A.3.3 Gradients

Using the intermediate variables and results presented above, direct calculation shows that:

∂R ∂f (q) = q 2f (q)µ 2 D(q) + 4µ f (q) m α m u u G m u (q) + 2 m m u u α m u α m u q f (q)H mm uu (q)

-µ C (q) -2