Simulating Market Impact in Strategy Backtests
Summary
The document considers how to simulate an order book for testing strategies that submit market and limit orders. It recommends beginning with a simplifying assumption: the simulated strategy’s orders are small enough not to alter the price path. This can support tests of strategies that do not rely on future information, while avoiding the harder problem of modeling how orders change the market.
For strategies with meaningful market impact, the reply suggests adding a cost that makes simulated trading less favorable. It cites a square-root relationship between impact and traded volume as a commonly used empirical form, with the coefficient potentially varying with volatility and average volume. Across many trades, impact may be approximated as an average increase in transaction costs. The source cautions that this aggregate treatment cannot predict which individual trades will be affected, and that an adversarial impact model can distort strategy behavior if the algorithm learns to exploit its assumptions. No calibration data or validation results are provided.
Key ideas
- Assuming orders have negligible impact is a useful starting point for strategy simulation.
- Strategies with meaningful market impact need an explicit penalty or transaction-cost adjustment.
- A commonly cited impact relationship grows with the square root of traded volume.
- Average added transaction costs can approximate aggregate impact across many trades.
- An adversarial impact model may mislead a strategy if it adapts to the simulator’s assumptions.
Tags
Full text
# How to simulate market data and test strategies?
# How to simulate market data and test strategies?
I am trying to implement my own exchange with simulated data and test some strategies on such data. What would be the best way to go about modelling the data that supports live interaction ( limit/market orders ) executed by my bot?
Simulating data on it's own seems easy, I can simulate bid and ask separetely using real world data, extrapolating prices from that and adding a probability distribution on top of it. But I am not certain how to adjust data given that I will be directly impacting the order books in somewhat realistic way.
## Answer by Attack68 (score 2)
https://quant.stackexchange.com/a/47011
As a starting point I would make the assumption that your new orders are negligibly small, in order that their market impact does not affect the trajectory of the price. This will provide a reasonable way to test strategies that do not possess any forward looking or snooping data.
When you are in the position that your actions are believed to impact the orderbook I would engineer some solution that disadvantages your position. Of course you must be careful not to adapt your algorithm to respond well to your own adversarial design (which may not really be reflective of the true market).
I have never used it but I believe Quantopian introduces this kind of concept as a trading drag in its back testing, essentially as an additional cost to transactions. Market impact is often empirically stated as $k\sqrt{V}$, i.e. some value (a constant or value dependent upon volatiliy and average volume) multiplied by the root of your volume.
Over the course of many transactions you would probably encounter the fact that any market impact arising from your transactions can be equivocated to a average increased transaction cost. You may never be able to predict which precise transactions are impacted or to what degree each transaction will be affected but by the law of large numbers / central limit theorem the total impact can be assessed with high confidence.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.