Skip to content
All library documents

Backtesting Strategies That Depend on Level 2 Order Book Data

Article Quant Q&A · Author: AllBlooming

Summary

The document considers how to evaluate an automated strategy whose entry decisions depend on Level 2 order book data. The trader can obtain historical tick data through their broker but lacks historical market depth for the CME and Globex equity index futures they target. They are weighing the cost of buying depth data or collecting it prospectively against paper trading before deploying the algorithm.

The response warns that apparent backtest success can arise from flawed design and that order book features may not generalize across assets with different liquidity and distributional properties. It also questions whether Level 2 data adds useful information beyond Level 1 and notes that acquiring and acting on depth data can be impractical for a real-time strategy. These are cautions rather than empirical results; the exchange does not provide a concrete validation procedure or quantify data costs, latency, or strategy performance.

Key ideas

  • A strategy that relies on Level 2 data requires historical order book records for a meaningful backtest.
  • Flawed backtests can make a strategy appear successful when results are artifacts.
  • Order book feature distributions and strategy behavior may differ across assets with different liquidity.
  • Data access and timeliness can limit whether a Level 2 strategy is practical to replicate.

Tags

Full text
# Backtesting with Level 2 depth of book


# Backtesting with Level 2 depth of book












I'm new to automated trading. I'm in the process of coding the methodology I've been using manually for a few weeks into a quantitative algorithm using IBKR and Python.

I read everywhere I should backtest my strategy before betting money it. Sounds like a great idea, of course.

Just a slight problem. My alogo depends on Level 2 market data to make the best guess on when to enter a position.

With IBKR, I can get historical tick-by-tick data, but no historical level 2.

Has anyone encountered a similar challenge? Should I build my own database of L2 data? Or should I just run my algo live with paper trading, make adjustments if necessary, and then go live?

Should I look for historical L2 data (I need CME/Globex equity index futures) elsewhere? Seems like the data is out there, but it's expensive.

Has anyone gone through a similar decision process? What recommendation do you guys have?

## Answer by develarist (score 2)

https://quant.stackexchange.com/a/54417

You should forfeit developing any sort of trading strategy based on level 2 data if its purely based on the belief that the level 2 book contains additional information of value over level 1.

First of all, your initial backtest design will, without a doubt, be highly susceptible to being flawed, making you think you accomplished something when in fact it's an artifact,

but on top of this, your strategy will likely only work for a highly-liquid asset and other assets with similar distribution to that asset, but will fall flat when confronted with low-liquidity assets and others like it that have a completely different genetic make-up than the assets for which your strategy was going a-ok. The distributions of level 2 features are known to be either elliptical and bell-shaped on one extreme, and pin-pointy on the other, where values are causing sharp, abrupt bimodality.

the fact that you are scavenging for level 2 books also points out how impractical data acquisition would be for a real-time trader in the market who wants to replicate your strategy. even if they had access to that market depth, it would still not be timely enough for high frequency trading.

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.