I have written a simulation that matches buy and sell orders, keeps track of an order book and simulates trades. My first pass at order submission was to generate random orders around the bid/ask spread. This does not produce a random walk in trade prices. What happens is the orders are distributed evenly but around the bid/ask spread they get traded out but beyond this they start clumping together thereby forming 'price resistance'for want of a better word. Is there an algorithm I can use that will result in a random walk for trade prices?


2 Answers 2


You have intense academic research on orderbook dynamics simulations, just cite:

  1. Econophysics: Empirical facts and agent-based models, by Anirban Chakraborti, Ioane Muni Toke, Marco Patriarca, Frederic Abergel (Arxiv 2010)
  2. High Frequency Simulations of an Order Book: a Two-Scales Approach by: Charles-Albert Lehalle, Olivier Guéant, Julien Razafinimanana, In Econophysics of Order-Driven Markets (2010) edited by: F. Abergel, B. K. Chakrabarti, A. Chakraborti, M. Mitra
  3. The Price Impact of Order Book Events, by Rama Cont, Arseniy Kukanov, Sasha Stoikov (Arxiv 2011)

(1) is a generic survey, (2) provides you a way to build consistent simulations and different scales (i.e. controlling the volatility, the bid-ask spread and their relation along the whole day), (3) is more local but allow to simulate a consistent way the order flow dynamics and the price one.

One simple way to improve you simulations is to:

  • have a model for the bid-ask spread
  • choose Point processes (Poisson or better: Hawkes) to model the input and output in the queues
  • use Rama's model to generate a price: when a queue (Bid or Ask) equals zero, move the price (down or up)

If you want to have proofs that the diffusive limit of a point process will be a Brownian motion, you can read for example:


Analyzing this question theoretically, I think the following strategy will result in a random walk.

  1. the average size of limit orders is much smaller than the average size of market orders;
  2. the size of market order is random, and subjects to a kind of distribution;
  3. market buy orders and market sell orders arrive at random but evenly;
  4. the size of limit order subjects to a kind of distribution.

I do not know your strategy by detail, so I am not sure if your have considered the above items already. But by guess, it may be the first requirement that bothers you. Too many limit orders on the best-bid / best-ask seems tend to prevent market prices from change. In fact, as long as limit orders at best-bid / best-ask have the opportunity to be exhausted, the simulation strategy will generate a random walk, you just need a longer time to watch the price to walk away. Any way, it can still be called a "random walk".


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.