Ergodic Transition in a Simple Model of the Continuous Double Auction

We study a phenomenological model for the continuous double auction, whose aggregate order process is equivalent to two independent queues. The continuous double auction defines a continuous-time random walk for trade prices. The conditions for ergodicity of the auction are derived and, as a consequence, three possible regimes in the behavior of prices and logarithmic returns are observed. In the ergodic regime, prices are unstable and one can observe a heteroskedastic behavior in the logarithmic returns. On the contrary, non-ergodicity triggers stability of prices, even if two different regimes can be seen.


Introduction
The continuous double auction is the trading system used by most regulated equity markets. The auction is called double as demand and offer are collected in a book where orders to buy and to sell are registered, and continuous because orders can be placed at any instant in a given daily time window. The detailed rules for trading may be different from one stock exchange to the other, but, essentially, things work as follows. Traders can either place buy orders (bids) or sell orders (asks) which are then registered in a book for a particular stock traded in the exchange. The limit order is the typical one. A bid limit order is specified by two numbers: the quantity q (T ) b that trader T wants to buy and the upper limit price p (T) b she is willing to pay for a single share. An ask limit order is an order to sell q (T) a units of the share at a price not smaller than a limit price p (T ) a selected by trader T. The couples (p (T) b ,q (T) b ) and (p (T) a ,q (T) a ) are written in the book and ordered from the best bid to the worst bid and from the best ask to the worst ask, respectively. The best bid is the price p b~m ax T[I b (p (T) b ), where I b is the set of traders placing bids, whereas the best ask is the price p a~m in T[Ia (p (T) a ), where I a is the set of traders placing asks. At every time t, one has that p a (t)wp b (t). Occasionally, a market order may take place, when a trader accepts a best bid or best ask price from the book, and the i-th trade occurs at the epoch t i . Stock exchanges specify rules for the priorities of limit orders placed at the same price and for execution of market orders with quantities that are not totally available at the present best price. The sequence of prices p(t i ) at which trades take place at epochs t i is an important process for understanding market dynamics. As detailed below, one can describe this sequence in terms of a suitable continuous-time random walk.

Model
In our model, following [1], prices assume N integer values from 1 to N. A price can be regarded as a class where orders are placed. This way of representing prices is a faithful representation of what happens in real markets due to price discretization. The only unrealistic feature is the presence of an upper limit to prices which we keep to ensure partial analytical tractability. Note that orders can be considered as objects to be classified by prices at which they are placed (see [2] for a general discussion on the problem of allocating objects to classes). We only consider two kinds of orders, namely, limit orders and market orders.
As discussed above, limit orders can be of two types: limit bid orders, i.e. orders to buy one share and limit ask orders, i.e. orders to sell one share. Market orders are also of two types as either the best limit bid order or the best limit ask order are accepted when a transaction occurs. When a market order arrives, only one limit order will be removed either from the best bid category or the best ask category, provided that these categories contain at least one order. In other words, we assume that all the orders are characterized by quantities equal to one share. We shall further assume that limit ask orders arrive following a Poisson process with rate l a and that limit bid orders arrive at a rate l b . These orders are written in the book and they wait until a market order arrives. Remember that the best limit bid orders, namely the limit bid orders offered at the highest price are always strictly smaller than the best limit ask orders, that is the limit ask orders offered at the lowest price. Market orders to buy, accepting one of the best ask orders, arrive in the market separated by exponentially distributed waiting times with parameter m b , whereas market orders to sell arrive with an exponential distribution of waiting times with parameter m a . If the book is empty, or if the appropriate side of the book is empty, market orders are not executed. It is necessary to remark that order inter-arrival times are not exponentially distributed in real markets [3] due to the non-stationary behavior of humans [4]. However, to ensure analytical tractability, here we assume that inter-arrival times are exponentially distributed. We shall further assume that limit ask orders are uniformly placed in the price classes from p b z1 to p b zn, where p b is the class of the current best bids. Conversely, limit bid orders are uniformly placed in the price classes from p a {n to p a {1, where p a is the class of the current best asks. As mentioned above, the accessible system states are limited by the condition p b vp a . When p a is between 1 and n (p b between N{nz1 and N), the bid (respectively, ask) interval is restricted correspondingly. For instance, if p a~1 , no bids are possible. Finally, if no orders are present in the book, the next bid, b, will be uniformly chosen in p{nƒbƒp and the next ask, a in pƒaƒpzn, where p is the price of the last trade. The specification of an initial price (which can be interpreted as the opening auction price) is then sufficient to start the auction. Figure 1 shows a state of this system and illustrates the meaning of the various descriptions. Note that the model outlined above is essentially the same as in [5] and [6]. In terms of agent-based models, it is a zero intelligence agent-based model [7]. However, our version does not suffer from using odd mathematical objects such as uniform distributions over semiinfinite intervals as in [5] and we do not assume that limit orders arrive only at the best bid/ask prices as in [6]. Actually, in our case limit orders arrive at prices that are different from the best bid/ ask. A preliminary discussion of our model was presented in [8].
The trade price process P(t) is a continuous-time random walk that we wish to characterize as Cont and de Larrard did in Sections 3 and 4 of [9]. However, they considered fixed bid-ask spread equal to one tick, whereas in our case the bid-ask spread is a random variable. Let T i denote the epoch of the i-th trade; in particular, we are interested in the behaviour of the following random variable called the tick-by-tick logarithmic return, where log stands for the natural logarithm. This is the usual variable used in statistical finance and financial econometrics for the analysis of tick-by-tick data [10]. It turns out that the behaviour of R i crucially depends on the presence or absence of statistical equilibrium in the supply mechanism.

Main Results
Indeed, there are two main regimes in this model and they are triggered by an ergodic transition. Let us denote by A(t) the total number of limit ask orders and by B(t) the total number of limit bid orders present in the book. By definition, these two random processes are independent and they are M=M=1 queues with rates l a and m b and l b and m a , respectively [11]. M=M=1 queues are the continuous-time equivalent of birth and death Markov chains. The conditions for the existence of statistical equilibrium (ergodicity) are given by the following inequalities Figure 1. A state of the system. Limit bid orders are depicted by circles whereas squares represent limit ask. Each order can be described by a label. An individual description is a list showing, for each limit order, whether it is a bid or an ask and to which category (price) it b e l o n g s . H e r e , i t i s x 1~( 8,a), x 2~( 9,a), a). A statistical description is a list that gives us the number of limit orders either of bid or of ask type contained in each category. In this case it is y a 1~. . .~y a 6~0 , y a 7~1 , y a 8~2 , y a 9~1 , y a 10~0 for ask orders and for bid orders. Finally, a partition description is the number of categories (prices) with zero limit ask or limit bid orders, one ask/bid limit order, etc.. In this case we have z a 0~7 , z a 1~2 , z a 2~1 for ask orders and z b for bid orders. doi:10.1371/journal.pone.0088095.g001 The intuitive meaning of these conditions is as follows. If the rate of arrival for limit orders is larger than the rate of market orders, then the number of orders in the book eventually explodes. However, in this case, prices will be able to fluctuate only among a few values. When the rate of market orders is larger than the rate of limit orders, the number of orders in the book remains finite and prices are free to fluctuate over the whole available range. In the ergodic regime, the invariant (and equilibrium) distributions of A(t) and B(t) are given by two geometric distributions and Given the independence between A(t) and B(t), the joint probability density is from which one can find the probability of finding an empty book For our further analysis, we shall focus on the case of a symmetric auction, assuming l a~lb~l and m a~mb~m and we shall consider the ratio r~l=m as the basic order parameter of the model. In fact, there is no reason for a random auction to be unbalanced towards selling or buying. As discussed above, if rv1, we are in the ergodic regime, whereas for r §1, we are in a regime where the orders accumulate and A(t),B(t)??, for t??. The two regimes give rise to two radically different behaviours for the tick-by-tick log-returns (1). This is qualitatively shown in Fig. 2, where we report the behavior of prices and log-returns in a Monte Carlo simulation for r~0:8 ( Fig. 2 (a)), r~1:2 ( Fig. 2 (b)) and for r~6 (Fig. 2 (c)). One can see by eye that, in the ergodic regime, high and low log-returns are clustered, whereas, in the non-ergodic one, such a volatility clustering does not occur. Fig. 2 (a) clarifies the origin of clustering. When the price is lower, log-returns are higher and the price process has the persistence behavior typical of random walks which immediately leads to clusters of low and high volatility as the price slowly moves up and down, respectively. The comparison between Fig. 2 (b) and Fig. 2 (c) shows that there are two sub-regimes in the non-ergodic case. If 1ƒrvn, even if A(t) and B(t) diverge, the limit orders belonging to the best bid and the best ask can be removed by market orders and prices can fluctuate among a set, whereas if r §n, then after a transient, the number of limit orders belonging to the best bid and the best ask diverges and prices can only fluctuate between two values. In this condition, the price process becomes a random telegraph process. This behavior is justified by the fact that the process of the number of orders at the best bid price (respectively, best ask) can be coupled with the state of an M=M=1 queue with arrival rate l b =n (l a =n) and service rate m a (m b ); this is so because limit orders, upon arrival, distribute uniformly over the n best prices. If l b =(m a n)~r=n §1, then the number of orders at the best bid price converges to infinity, as t??, meaning that all trades will occur at the price where the bids accumulate. If l b =(m a n)~r=nv1, then the queue of the best bids eventually empties with probability one, meaning that there is a positive probability that the trading price changes. However, if we are in the region 1 n ƒ l b m a n~r n v1, then we know that A(t),B(t)??, as t??. This means that the queue of the bids at some price will eventually never empty, which means that trades at lower prices will never occur. By symmetry, the same argument holds for asks.  Descriptive statistics of log-returns and the autocorrelation coefficient at the first lag of absolute log-returns (c 1 ) for different r, made on 1000 runs of simulation of 10 6 events. doi:10.1371/journal.pone.0088095.t001 The transition between regimes can be detected studying the moments of log-returns. In Table 1, we give the descriptive statistics for log-returns, including mean, standard deviation, skewness and kurtosis as well as the autocorrelation coefficient at the first lag of absolute log-returns, c 1 , for different values of the parameter r. These statistics are computed on 1000 simulation runs with 10 6 events. Figure 3 shows standard deviation, kurtosis and c 1 in more detail, namely mean values and error bars are given for these three quantities estimated from 1000 runs. One can see that these quantities increase in the non-ergodic case.
Our findings can be compared with those presented in a recent study of financial stylized facts [12], where authors find that higher rate of limit orders stabilizes the market by decreasing the standard deviation of returns. In Fig. 4, we plot the sample autocorrelation for the tick-by-tick absolute log-return series for r~0:8, r~1:2 and for r~6. A slow decay of the ACF in ergodic case, showing long range-memory as well as heteroskedasticity, reminds the stylized facts found in financial data. One can see that this decay is much faster if r increases.
In Fig. 5, we plot the complementary cumulative distribution of kurtosis values (Fig. 5 (a)) and of c 1 (Fig. 5 (b)) for 1000 simulations and for different values of r in order to corroborate the observation made above: there is a jump in the kurtosis of logarithmic returns as well as a jump in the first-lag autocorre-lation of absolute log-returns as r moves from values larger than 1 to values smaller than 1.

Conclusions
In summary, in this paper we have shown that a symmetric continuous double auction model has three regimes depending on the value of the parameter r. If 0vrv1, we are in the ergodic regime and prices are free to fluctuate over the full available price range. In this regime, some of the so-called stylised facts of finance appear, such as the heteroskedasticity of log-returns as shown in Fig. 4 (a). However, this particular behaviour is simply due to the persistence of the price process which is stronger when the parameter n is smaller. An eye inspection of Fig. 2 (a) shows that volatility clustering is caused by the fact that when the price is small (close to zero), returns are larger than when the price is large (close to N). If n is small, the probability of large price jumps is zero and the trade price remains close to its current value for some time. For r §1, we have the transition to a non-ergodic regime which stabilizes prices; they are no longer allowed to freely fluctuate over all the available price range. However, there is a further transition. If 1ƒrvn, where n is the size of the allowed range for limit orders, prices can still fluctuate within a limited range. If r §n, then prices will eventually fluctuate between two values. If one sets n~1, this transition disappears. In fact, if n~1, in the non-ergodic regime, limit orders accumulate only at the best  bid and best ask value. Even if this further transition is a feature of our simplified model, the distinction between the ergodic and non-ergodic regimes is relevant for real equity markets. A consequence of these results is that too frequent order removals may lead to price instability. Our educated guess, which will be the subject of further research, is that real markets live in the nonergodic regime, but not too far from the threshold.

Monte Carlo simulations
Monte Carlo simulations of the auction model were performed with a MATLABHcode that is included in File S1. There are two functions: cda.m and order.m. cda.m is a plain simulation of the auction following the description in section Model. It calls the function order.m that generates the flow of orders according to the described distributions.

Theory
All the theoretical results presented here are corollaries of theorems on M=M=1 queues from queueing theory [11]. The notation M=M=1 means Markovian arrival process, Markovian server process and 1 server and it is due to Kendall [13].

Supporting Information
File S1 Supporting information. (PDF)