Backtesting Market-Making Strategies with Replay and Order-Flow Models
Summary
The document explores why historical replay alone may not faithfully test market-making or other microstructure strategies. A replay uses recorded order-book events, but cannot fully capture how other participants would react to the strategy's orders. The proposed progression is to begin with replay under sensible constraints, such as preventing duplicate liquidity removal and unrealistic reaction speeds, then consider models that simulate order-book event arrivals.
Two modeling choices are described: condition event rates on book state and future price information, or use current book state alone through a queue-reactive approach. The former incorporates information available in historical data but uses future prices; the latter avoids that input but may produce excessive price movement when a strategy consumes liquidity. The responses also emphasize limits in estimating queue position, exchange latency, and informed traders, suggesting that some high-frequency strategies require live measurement or forward testing. These are methodological perspectives, not comparative results established by the document.
Key ideas
- Historical market replay is a useful starting point but cannot reproduce all strategic reactions.
- Replay constraints can prevent unrealistic actions such as consuming the same liquidity twice.
- Order-book event arrival rates can be modeled from book state, with or without future-price information.
- Queue position, exchange latency, and informed order flow are difficult to estimate in a backtest.
- Forward testing may be needed to assess execution-sensitive high-frequency strategies.
Tags
Full text
# Backtesting Market Making Strategy or Microstructure Strategy # Backtesting Market Making Strategy or Microstructure Strategy How does one backtest either a market making strategy or microstructure-based strategy? I'd imagine that one way would be to record order book states over time and then insert the orders, but it seems like this is problematic since it neglects the reactions other traders may have to a new order. Also, if we intuitively knew that a strategy would be predated, there would be little incentive to pursue backtesting it anyway. So the question then becomes, how do you backtest the actions of other unknown traders? ## Answer by lehalle (score 19, accepted) https://quant.stackexchange.com/a/40463 This is a very difficult question. - First of all you should read Almgren's slides on the topic: Using a Simulator to Develop Execution Algorithms. First you need to backtest your strategy against a "replayer". Ok it is not perfect, but it gives you information anyway. Provided you add some "sanity limitation" to this simulator (i.e. do not allow you strategy to remove the same liquidity two times, or to react too fast to market events), you will obtain something not too bad. - Then you can follow the methodology proposed in High-Frequency Simulations of an Order Book: a Two-scale Approach by L-Guéant-Razafinimanana. It addresses exactly the case you have in mind. The proposed solution is: model the arrival rate of orderbook events given the state of the orderbook and the future price (yes you have access to the future price in historical data). - If you want to remove any use of this "future", you can use simply use arrival rates of orderbook events given the current state of the orderbook following Simulating and Analyzing Order Book Data: The Queue-Reactive Model by Huang, L, and Rosenbaum. In short: if you use (1) you may not take into account enough others' reaction; if you use (3) you may obtain simulations that will ove the price too much (especially if your strategy is highly liquidity consuming), and with (2) you will be in-between. ## Answer by wildbunny (score 5) https://quant.stackexchange.com/a/43355 IMO you can't backtest a HFT strategy because you cannot account for your own queue depth, or the API lag of the exchange, and more importantly, you cannot really model informed traders very well, who will pick off your badly placed limit orders. For a broad range of HFT strategies, good queue depth is everything(1), and this isn't something you can just guess, you have to measure it in practice. This essentially just means forward testing and a lot of screen watching in my experience. (1) http://market-microstructure.institutlouisbachelier.org/uploads/91_7%20MOALLEMI%202014-12-paris-mm-queue-value.pdf ## Answer by BGasperov (score 4) https://quant.stackexchange.com/a/55803 Just a brief remark - here's a paper you might find interesting. The authors compare "market replay" trading strategies (roughly the same as backtesting) with more sophisticated "interactive agent-based simulations".
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.