Mathestate Logo

 

Continuous Double Auction Model

In a simple continuous double auction model, limit buy orders and sell orders are accumulated in order arrays.  Market orders also come in as buy and sell orders.  For simplicity only an order of a unit volume is considered.  As market orders come in within some small unit time interval, they are matched and executed at the last market price.  When there is an excess of buy or sell orders within the order matching time interval they are executed through the limit sell and buy order books respectively.  For the model the number of buy and sell orders coming in during each order matching interval is assumed to be a Poisson random variable.  To keep the model as simple as possible, we consider only the net of buy or sell orders and do not include the orders that are matched at the market price.  Log prices are used in the algorithm and converted back to prices rounded to the nearest penny.  The rounding process, creates a significant number of sequentially equal prices.  The limit order books are refreshed for each matching interval.

For the model the arrival of market buy and sell orders is assumed to be governed by a Poisson distribution.  We match when we have 200 orders.  Since we are primarily interested in price changes we bother only with the difference of buy and sell orders and go to the appropriate order book with that difference.  The histogram shows how orders will be distributed.  We can create skewness by adjusting parameters so that the expected mean will not be zero.

Graphics:Difference between Buy and Sell Orders in a Matching Interval

We use a heavy tailed Pareto distribution for limit order prices.  For the example alpha for the limit order book is 1.8.  A scale factor of 1/1000 is used, and the number of orders in the order book are set at 30 for each refresh interval.  The buy and sell order books are considered to be identically distributed but differ only by sign, so the refresh is only done once.  The model may easily be changed to different distributions for the order book.

Graphics:Distribution of Limit Order Book Returns

Do a run of 10,000 matching intervals.
The algorithm is simplified so that large order books are not refreshed.  If the limit order book isn't big enough the excess is ignored and the next cycle started.  This short cut is not problematic unless parameters are selected so that the differences in the orders regularly exceed the limit book.  On the other hand if the limit book in this model is too long relative to the number of orders in the matching period, then extreme events at the tails will not occur, and the summed distribution will be normal.  Only unmatched orders mktnet are considered in this version.  Matched orders don't change the price in the model.  lmtlen needs to be closely matched to the maximal expected absolute values of mktnet or the fat-tails won't occur.  The Mathematica algorithm is shown below.

CDA_3.gif

CDA_4.gif

A plot of all the prices.

CDA_5.gif

Sum the log returns of prices at intervals of 50 prices then calculate stable parameters of summed log returns.

Graphics:Log Returns

The system outputs true stable tails, as expected by the generalized central limit theorem.

Stable parameters
1.50834,  0.13257,  0.00262663,  0.000301686,  

CDA_7.gif

Graphics:Log Log Left Tail Blue, Right Red, (Normal Green)

We have created a simple model of a continuous double auction.  It has heavy tails generated by a Pareto distribution, but other distributions could easily be used.  Research by Farmer, suggests that limit order books do indeed have heavy power tails.  The model was designed to yield the output of a stable distribution.  Adjusting some of the parameters can change things dramatically.

Follow the link to take a side tour exploring how power tail distributions might arise in financial markets.

CDA_9.gif



© Copyright 2008 mathestate    Fri 19 Dec 2008