2
$\begingroup$

What are some standard simple ways of simulating an order book? I have found this paper, but it is missing the implementation details. And more importantly, it appears that it ignores the size of the limit orders when it "sweeps" the orders.

I am interested in backtesting a strategy where the size of the limit orders that I place into the order book - matter.

Any pointers would be highly appreciated.

$\endgroup$
2
  • 1
    $\begingroup$ just a quick comment, but if you backtest against a parametrised order book distribution then your results will likely depend on that assumption. It would also be worth investigating the sensitivity of the backtest to varying your parameters of the prder book; whatever you happen to come up with.. $\endgroup$
    – Attack68
    Jun 2, 2019 at 18:42
  • $\begingroup$ that is a good point. I really liked the paper I linked at the start because it was not modelling the book explicitly. Rather they used a simple Geometric Brownian motion to simulate the price and then on top of that they simulate limit order arrivals (price + time + size). So all one would need is: 1. drift + vol for brownian motion; 2. interarrival times + distribution of sizes + the prices of limit orders. However, they do not reveal the details of how to simulate those limit orders exactly. $\endgroup$
    – Naz
    Jun 2, 2019 at 18:49

1 Answer 1

4
$\begingroup$

Nowadays (4 years after your question...), the best way to simulate orderbook dynamics is probably to implement the Queue Reactive model, from Huang, Weibing, C-A L, and Mathieu Rosenbaum. "Simulating and analyzing order book data: The queue-reactive model" Journal of the American Statistical Association 110, no. 509 (2015): 107-122.

It works the following way

  1. It will give you the intensity of the occurrences of events on the book: insert, cancel, trade, at any point in time
  2. The input will be the shape of the orderbook; it is enough (according to the findings of the paper) to keep track of the size of the considered queue, and the one just before plus the one just after (dimension 3).

That for

  1. summarise the shape of the orderbook by using the Average Event Size (AES) in your dataset; thanks to that you have the size $Q_k$ of any queue discretised in AES. Say $k$ is negative for the bid side and positive for the ask side.
  2. for each queue $k$, get the intensities $\lambda_{\rm cancel}, \lambda_{\rm insert}, \lambda_{\rm trade}$ of the 3 potential next events from the value of $(Q_{k-1},Q_k,Q_{k+1})$.
  3. Simulate points processes for these events.
  4. Implement the first one that occurs in your simulation.
  5. Update the queue sizes (you can us a zero intelligence model for the size of events),
  6. Loop
$\endgroup$

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.