Order book model with log-normal depth

We continue our series of posts on order book models by considering an order book model proposed by Tobias Preis [1], which is able to reproduce log-normal order book side profile. There are more modifications of this model considered in the aforementioned paper [1]. One of them is simpler and reminiscent of the order book model by Cristelli, which was discussed in a previous post, couple of them are more sophisticated and able to reproduce other interesting stylized facts.

It is quite possible that we will discuss some of the modifications sometime later on Physics of Risk, but now let us describe the chosen version of the model proposed by Tobias Preis.

The model

We initialize this model by filling it with order uniformly distributed around best bids. The original paper did not specify any specific model initialization rules, hence we picked on our own. So please allow certain burn-in period for the model to allow for its true dynamics to emerge.

Once again the price in the model is defined as an average between the best bids:

\begin{equation} p(t) = \frac{a_0(t) + b_0(t)}{2} , \end{equation}

here \( a_0(t) \) and \( b_0(t) \) are best ask and bid quotes at a given time \( t \). As in the previous post we took liberty to define the price, in case of any side of the order book would be emptied, as the last executed order price.

Once again in the model quotes are defined in integer price ticks relative to some reference level (price at "zero" level). No quote may be expressed in fractional price ticks. In this sense price tick is smallest unit of price. To keep matters simple we, without loss of generality, set price tick to unit.

In the original paper [1] time is also discrete, but the model is formulated in a way which allows to implement it in "somewhat" continuous time. To achieve this we use the so-called Gillespie algorithm [2]. In the Gillespie algorithm discrete times steps are replaced with the Monte Carlo (random) time steps. Hence the model is updated in a Poissonian manner producing the illusion of continuous time. Despite this difference our implementation should produce the same results as the original model.

In this model we have two types of agents: liquidity providers and liquidity takers. There are \( N_a \) agents of each of these types (hence in total there are \( 2 N_a \) agents). Liquidity providers provide liquidity by submitting limit orders at rate \( \alpha \). While liquidity takers consume the liquidity by submitting market orders with rate \( \mu \).

Liquidity providers may also consume liquidity by canceling orders at rate \( \delta \). There are numerous distinct ways to implement cancellation of the orders. One way is to remove one random limit order, which was not executed yet, at some rate. Similarly one could remove a random limit order taking into account order's side (first pick random side, then pick random order from that side). We have implemented a third alternative - on limit order creation the order is assigned both its quote and its expiry time (assuming certain cancellation rate). If the order is not executed until its expiry time, then it is canceled. From reading the original paper [1] it is not clear which interpretation was used to produce the reported results. Some parts of the paper hint at the third interpretation, others at the first.

Agents of both types decide to buy or sell depending on their respective probabilities. Liquidity provider will submit a buy limit order with probability \( q_{provider} \) and liquidity taker will submit a buy market order with probability \( q_{taker} \).

All that is left to define is how the liquidity providers decide on their quotes. In the previous post the agents drew quotes from uniform distribution bounds of which depended on the current order book spread. In this model a simpler assumption is made - quotes are drawn from uniform distribution bound of which depend on exponential random variable, \( \eta \):

\begin{equation} \eta = \lfloor - \lambda_0 \ln u \rfloor , \end{equation}

here \( u \) is a random variable drawn from \( \mathcal{U}(0,1) \). The new limit ask quotes are drawn from uniform distribution with bounds:

\begin{equation} [ b_0(t)+1 , b_0(t) + \eta +1 ] . \end{equation}

The new limit bid quotes are drawn from uniform distribution with bounds:

\begin{equation} [ a_0(t) - \eta -1 , a(t)-1 ] . \end{equation}

In the original paper [1] the model dynamics were discretized at periods of 1 MCS, which consists of \( 2 N_a \) smallest model steps (during each of which one agent would be selected). As in such case even with reasonably small \( N_a \) model would take considerable time to evaluate, we have picked a smaller time step for our simulation - and defined our simulation time step as \( 0.2 N_a \).

Here we once again use price change in price ticks instead of return. Price change in measured with after each our simulation step:

\begin{equation} r(t) = p(t) - p(t - 1) = \Delta p(t). \end{equation}

Interactive applets

To understand the model and its dynamics better you should study the interactive applets below.

The first applet, as has become usual, shows us how the structure of the order book evolves as the time goes on. Note that unlike in all other cases here we have relative price on the x axis, thus negative prices are also possible. Note that both sides of the order book look symmetric and have log-normal shape (the center is smooth, while the tails behave differently: one falls off quickly, while the other decays significantly slower).

The second applet is in certain sense traditional Physics of Risk applet for all financial market models. Though there are some specific differences related to the model in question.

First of all instead traditional price, or log-price, series plot on the bottom left you see relative price series plot. Recall that this model operates using distances in price ticks from some undefined reference level. To get price series you should add some fixed number (price at "zero" level).

Also instead of return in traditional sense (difference of log-price at two different points in time) we have "price change" and use \( | \Delta p | \) notation. This model lacks some important ingredients to reproduce power-law "price change" PDF. Actually "price change" in this model is normally distributed.

esf logo

Acknowledgment. This post was written while reviewing literature relevant to the planned activities in postdoctoral fellowship ''Physical modeling of order-book and opinion dynamics'' (09.3.3-LMT-K-712-02-0026) project. The fellowship is funded by the European Social Fund under the No 09.3.3-LMT-K-712 ''Development of Competences of Scientists, other Researchers and Students through Practical Research Activities'' measure.

References

  • T. Preis. Simulating the microstructure of financial markets. Journal of Physics: Conference Series 221: 012019 (2010). doi: 10.1088/1742-6596/221/1/012019.
  • D. T. Gillespie. Exact Stochastic Simulation of Coupled Chemical Reactions. The Journal of Physical Chemistry 81: 2340-2361 (1977). doi: 10.1021/j100540a008.