Browse Subject Areas

Click through the PLOS taxonomy to find articles in your field.

For more information about PLOS Subject Areas, click here.

  • Loading metrics

Ergodic Transition in a Simple Model of the Continuous Double Auction

  • Tijana Radivojević,

    Affiliation BCAM - Basque Center for Applied Mathematics, Bilbao, Basque Country, Spain

  • Jonatha Anselmi,

    Affiliation BCAM - Basque Center for Applied Mathematics, Bilbao, Basque Country, Spain

  • Enrico Scalas

    Affiliations Department of Mathematics, School of Mathematical and Physical Sciences, University of Sussex, Brighton, United Kingdom, BCAM - Basque Center for Applied Mathematics, Bilbao, Basque Country, Spain

Ergodic Transition in a Simple Model of the Continuous Double Auction

  • Tijana Radivojević, 
  • Jonatha Anselmi, 
  • Enrico Scalas


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.


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 that trader wants to buy and the upper limit price she is willing to pay for a single share. An ask limit order is an order to sell units of the share at a price not smaller than a limit price selected by trader . The couples and 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 , where is the set of traders placing bids, whereas the best ask is the price , where is the set of traders placing asks. At every time , one has that . Occasionally, a market order may take place, when a trader accepts a best bid or best ask price from the book, and the -th trade occurs at the epoch . 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 at which trades take place at epochs 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.


In our model, following [1], prices assume integer values from to . 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 and that limit bid orders arrive at a rate . 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 , whereas market orders to sell arrive with an exponential distribution of waiting times with parameter . 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 to , where is the class of the current best bids. Conversely, limit bid orders are uniformly placed in the price classes from to , where is the class of the current best asks. As mentioned above, the accessible system states are limited by the condition . When is between and ( between and ), the bid (respectively, ask) interval is restricted correspondingly. For instance, if , no bids are possible. Finally, if no orders are present in the book, the next bid, , will be uniformly chosen in and the next ask, in , where 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 semi-infinite 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].

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 belongs. Here, it is . 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 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 for ask orders and for bid orders.

The trade price process 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 denote the epoch of the -th trade; in particular, we are interested in the behaviour of the following random variable(1)called the tick-by-tick logarithmic return, where 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 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 the total number of limit ask orders and by the total number of limit bid orders present in the book. By definition, these two random processes are independent and they are queues with rates and and and , respectively [11]. 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(2)and(3)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 and are given by two geometric distributions(4)and(5)Given the independence between and , the joint probability density is(6)from which one can find the probability of finding an empty book(7)

For our further analysis, we shall focus on the case of a symmetric auction, assuming and and we shall consider the ratio 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 , we are in the ergodic regime, whereas for , we are in a regime where the orders accumulate and , for . 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 (Fig. 2 (a)), (Fig. 2 (b)) and for (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 , even if and 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 , 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 queue with arrival rate () and service rate (); this is so because limit orders, upon arrival, distribute uniformly over the best prices. If , then the number of orders at the best bid price converges to infinity, as , meaning that all trades will occur at the price where the bids accumulate. If , 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 , then we know that , as . 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.

Figure 2. Time series of prices and log-returns.

Time series of prices and log-returns in a system of prices, length of interval for placing orders , with initial price and number of simulated events . (a) ergodic case (); (b) non-ergodic case for () and (c) non-ergodic case for ().

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, , for different values of the parameter . These statistics are computed on 1000 simulation runs with events.

Figure 3 shows standard deviation, kurtosis and 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.

Figure 3. Mean values and error bars.

Mean values and error bars of the standard deviation (a), kurtosis (b) of log-returns and the first-lag autocorrelation of absolute log-returns (c) as functions of the parameter , estimated from 1000 Monte Carlo simulations.

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 , and for . 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 increases.

Figure 4. Sample autocorrelation functions for the absolute log-returns.

(a) ergodic case (); (b) non-ergodic case for () and (c) non-ergodic case for ().

In Fig. 5, we plot the complementary cumulative distribution of kurtosis values (Fig. 5 (a)) and of (Fig. 5 (b)) for 1000 simulations and for different values of 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 autocorrelation of absolute log-returns as moves from values larger than to values smaller than .

Figure 5. Empirical complementary cumulative distribution functions.

Empirical complementary cumulative distribution functions of the kurtosis of logarithmic returns (a) and the autocorrelation at the first-lag of absolute log-returns (b) for different values of .


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 . If , 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 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 ). If is small, the probability of large price jumps is zero and the trade price remains close to its current value for some time. For , 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 , where is the size of the allowed range for limit orders, prices can still fluctuate within a limited range. If , then prices will eventually fluctuate between two values. If one sets , this transition disappears. In fact, if , 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 non-ergodic regime, but not too far from the threshold.


Monte Carlo simulations

Monte Carlo simulations of the auction model were performed with a MATLAB®code 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.


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

Supporting Information

File S1.

Supporting information.



We wish to thank Mauro Politi for inspiring discussions.

Author Contributions

Analyzed the data: TR. Wrote the paper: ES. Wrote the code in File S1 and ran the Monte Carlo simulations: TR. Applied queuing theory and derived most of the theoretical results: JA. Conceived the model and derived some analytical results: ES.


  1. 1. Cont R, Stojkov S, Tareja R (2010) A stochastic model for order book dynamics. Operations Research 58: 549–563.
  2. 2. Garibaldi U, Scalas E (2010) Finitary Probabilistic Methods in Econophysics. Cambridge UK: Cambridge University Press.
  3. 3. Scalas E, Kaizoji T, Kirchler M, Huber J, Tedeschi A (2006) Waiting times between orders and trades in double-auction markets. Physica A 366: 463–471.
  4. 4. Barabási AL (2010) Bursts: The Hidden Pattern Behind Everything We Do. Penguin Group US.
  5. 5. Smith E, Farmer JD, Gillemot L, Krishnamurthy S (2002) Statistical theory of the continuous double auction. Quant Financ 3: 481–514.
  6. 6. Zuo S, Li M, Kishimoto K, Endo M (2009) A queuing model for a continuous double- auction trading system. In: 22nd Australasian Finance and Banking Conference 2009.
  7. 7. Gode DK, Sunder S (1993) Allocative efficiency of markets with zero-intelligence traders: Market as a partial substitute for individual rationality. Journal of Political Economy 101: 119–137.
  8. 8. Radivojević T, Anselmi J, Scalas E (2012) A stylized model for the continuous double auction. In: Managing Market Complexity, Lecture Notes in Economics and Mathematical Systems. Berlin: Springer, volume 662, pp. 115–125.
  9. 9. Cont R, de Larrard A (2013) Price dynamics in a Markovian limit order market. SIAM Journal on Financial Mathematics 4: 1–25.
  10. 10. Scalas E (2006) The application of continuous-time random walks in finance and economics. Physica A 362: 225–239.
  11. 11. Asmussen S (2003) Applied Probability and Queues. Springer, Berlin.
  12. 12. Brandouy O, Corelli A, Veryzhenko I, Waldeck R (2012) A re-examination of the “zero is enough” hypothesis in the emergence of financial stylized facts. J Econ Interact Coord 7: 223–248.
  13. 13. Kendall DG (1953) Stochastic processes occurring in the theory of queues and their analysis by the method of the imbedded Markov chain. Ann Math Statist 24: 338–354.