AnyLearn
All lessons
AIadvanced

Architectures for Order Book Data, and Why They Help Less Than Expected

Convolutional and recurrent networks have been applied to order book data with published success, and the architectures encode real assumptions about the book's structure. This lesson explains what each one assumes, why the gains over simple baselines are smaller than headline numbers suggest, and where the modelling effort is better spent.

Updated · AI-authored, review-gated · how lessons are made

Not signed in: your progress and quiz score won't be saved.
Progress1 / 10

The input has a shape, and the shape has meaning

A book snapshot is a matrix: rows are time steps, columns are the price and size at each level on each side. That looks like an image, and the resemblance is why convolutional networks were tried first.

The resemblance is only partial, and the differences matter.

An imageA book snapshot matrix
Both axesspatial, interchangeableone is time, one is book level
Neighbourhoodpixels near each other are relatedadjacent levels are related; adjacent columns may be price and size
Translation invariancea cat is a cat anywherethe touch is privileged; level 1 is not level 8
Channel meaningcolour, roughly equivalentprice and size are different quantities entirely

Key idea: Column ordering is a modelling decision, not a property of the data. Interleaving as price, size, price, size means a filter spanning two columns mixes a price with a size, which are not commensurable. Grouping prices together and sizes together means a filter sees comparable quantities. The same network on the same data gives different results depending on this choice alone.

Full lesson text

All 10 steps on one page, for reading, reference, and search.

Show

1. The input has a shape, and the shape has meaning

A book snapshot is a matrix: rows are time steps, columns are the price and size at each level on each side. That looks like an image, and the resemblance is why convolutional networks were tried first.

The resemblance is only partial, and the differences matter.

An imageA book snapshot matrix
Both axesspatial, interchangeableone is time, one is book level
Neighbourhoodpixels near each other are relatedadjacent levels are related; adjacent columns may be price and size
Translation invariancea cat is a cat anywherethe touch is privileged; level 1 is not level 8
Channel meaningcolour, roughly equivalentprice and size are different quantities entirely

Key idea: Column ordering is a modelling decision, not a property of the data. Interleaving as price, size, price, size means a filter spanning two columns mixes a price with a size, which are not commensurable. Grouping prices together and sizes together means a filter sees comparable quantities. The same network on the same data gives different results depending on this choice alone.

2. The reference architecture

The best-known model in this area is DeepLOB, from Zhang, Zohren and Roberts, published in IEEE Transactions on Signal Processing in 2019. Its structure has become the default starting point, and each stage encodes a specific assumption.

  1. Convolutional layers over the level dimension. Filters shaped to span a price and its size, then to span levels, so the network builds features like imbalance rather than being handed them.
  2. An inception-style module. Parallel filters of different widths, so the model can attend to patterns spanning one level or many without that being fixed in advance.
  3. An LSTM over time. Captures dependence across the sequence of snapshots, which convolution over a fixed window cannot.
  4. A three-class output. Up, down or flat over a chosen horizon.

It was evaluated against the FI-2010 benchmark of Ntakaris and colleagues, and on a year of London Stock Exchange quotes.

In practice: The convolutional stages are best understood as learning the feature engineering rather than replacing it. What they build resembles the imbalance and relative-depth features a practitioner would construct by hand, which is a useful sanity check: if the learned first-layer filters look nothing like those quantities, something is wrong with the input scaling.

3. What each family assumes

The architecture encodes a prior about where structure lives, and choosing one is choosing that prior.

FamilyAssumesStrengthWeakness
Logistic regression on engineered featuresyou know what mattersfast, interpretable, hard to beatlimited to the features you built
Gradient-boosted treesinteractions among tabular featuresstrong baseline, handles mixed scalesno sequence modelling
CNN over levelslocal structure across adjacent levelslearns imbalance-like featuresfixed receptive field
LSTM or GRUordered temporal dependencehandles irregular sequences naturallyslow, hard to parallelise
Transformerany-position dependence via attentionflexible, no fixed windowdata-hungry; quadratic in sequence length
Point-process modelsevents arrive at a state-dependent ratemodels timing as well as directionmore assumptions, harder to fit

Key idea: Gradient-boosted trees on well-constructed features are the baseline that matters, and the one most often omitted. A deep model reported without it has not demonstrated that its depth contributed anything. The last row is the most under-used: the timing of the next event is often more predictable than its direction, and only the point-process family models it directly.

4. Modelling when things happen, not just what

Standard sequence models treat the input as an ordered list and mostly ignore the intervals between items. In a book, those intervals are information.

Hawkes processes model event arrivals as self-exciting: each event raises the probability of further events for a while, so the arrival rate depends on recent history.

λ(t)=μ+ti<tαeβ(tti)\lambda(t) = \mu + \sum_{t_i < t} \alpha \, e^{-\beta (t - t_i)}

That form matches something real. Order flow clusters: a trade makes another trade more likely almost immediately, because large orders are worked in slices and because other participants react.

In practice: This matters for execution more than for direction. Whether the next five seconds will be busy or quiet is a genuinely predictable quantity, considerably more predictable than which way the price will go, and it is directly useful for deciding when to place an order. A model that forecasts activity rather than direction is solving an easier problem with a clearer use.

5. Multi-venue and cross-asset structure

Single-book models leave two structural signals on the table, both of which are more reliable than anything within one book.

  • Fragmentation. The same instrument trades on several venues. Their books do not update simultaneously, so one venue's move is informative about another's for as long as it takes information to propagate, which is a latency question rather than a prediction one.
  • Cross-asset lead-lag. An index future, its ETF and its constituents are mechanically linked by arbitrage. Movements in the most liquid instrument lead the others, and this is one of the most durable relationships in market data because it is enforced by arbitrage rather than discovered statistically.

Key idea: These signals are more robust than intra-book patterns precisely because they rest on a mechanism rather than a regularity. Arbitrage forces the relationship, so it does not decay the way a statistical pattern does. They are correspondingly the most competitive, since the mechanism is obvious to everyone and the race is on latency rather than on modelling.

A model reading only one book is ignoring the part of the problem where the structure is clearest.

6. Why the gains are smaller than they look

Published comparisons routinely show deep models beating simple ones by wide margins. Three things usually account for most of that gap, and none is depth.

  1. The baseline was weak. Logistic regression on two raw features is not a baseline. Gradient-boosted trees on well-constructed imbalance, spread and depth features is, and it is frequently absent from the comparison.
  2. The features were unequal. The deep model receives ten levels of history; the baseline receives a snapshot. That compares inputs, not architectures.
  3. The evaluation had leakage. Random splits on overlapping windows inflate every model, and inflate the higher-capacity one more, for the reasons the financial machine learning course establishes.

Gotcha: Point three interacts with point one in a way that produces exactly the wrong conclusion. Leakage rewards capacity, so a leaky evaluation makes deep models look better relative to simple ones, which is precisely the comparison being reported. The apparent evidence for depth is partly evidence of the leak.

The controlled test is to give every model identical features and an identical purged split, and to include a properly tuned tree ensemble. Gaps usually shrink substantially.

7. The latency budget rules out most of this

Predict first

Your model predicts the next book move with genuinely useful accuracy, and inference takes 50 milliseconds. The signal decays over roughly one second. Is the model usable?

That constraint eliminates most large architectures from the live path regardless of accuracy, and it explains a pattern that otherwise looks strange: production systems in this space are often much simpler than published research, because the published model was never subject to the constraint.

In practice: The usual resolution is to split the problem. A large model runs offline to discover structure and to calibrate; a small, fast model, sometimes a linear function distilled from the large one, runs in the live path. The deep network becomes a research tool rather than a trading component, and that is a legitimate and common outcome rather than a failure.

8. Where depth genuinely helps

The argument so far is sceptical, and it is worth being precise about the cases where a larger model does earn its place.

  • Learning features you would not have written. Convolutional stages can discover combinations across levels that hand-engineering misses, and inspecting them sometimes yields a feature you then compute directly and cheaply.
  • Many instruments at once. A single model across hundreds of names shares structure and reduces the per-name overfitting that separate models suffer, and this is one of the clearest wins.
  • Long and irregular context. Where the relevant history is minutes of unevenly spaced events, sequence models handle naturally what fixed windows handle badly.
  • Distillation targets. A large model that reaches good accuracy offline defines what is achievable, and a fast model can then be trained to approximate it.

Key idea: The second item is the strongest practical case and the least discussed. The scarce resource here is not model capacity but independent data, and a shared model across instruments is a way of getting more of it. That is a statistical argument rather than an architectural one, which is fitting given everything else in this lesson.

9. A build order

The sequence that avoids the most wasted effort, and each step is a gate rather than a suggestion.

  1. Build a features-plus-trees baseline first, with proper purged validation. This is the number every later model must beat, and sometimes nothing does.
  2. Verify the baseline beats the majority class. As the next lesson shows, at short horizons that bar is much higher than intuition suggests.
  3. Fix the input representation before touching architecture: stationary features, sensible column ordering, event sampling, elapsed time retained.
  4. Add sequence modelling only if the baseline is context-limited, which you can test by extending the baseline's lookback and seeing whether it helps.
  5. Measure against the latency budget throughout, not at the end, because it may eliminate the model regardless of accuracy.
  6. Pool across instruments before making a single-instrument model larger.

In practice: Steps 1 and 2 kill more projects than the rest combined, and killing them there is cheap. Reaching step 6 with a model that never cleared step 2 is the most common way this work is wasted.

10. The honest position on architecture

Deep learning on order books is a legitimate research area with genuine results, and the results are smaller and more fragile than the literature's headline numbers imply.

The reasons are structural rather than a criticism of any particular paper. The signal is small and short-lived. The competition holds the same data and better hardware. The evaluation is easy to get wrong in a direction that flatters capacity. And the deployment constraint eliminates most of the models that win offline comparisons.

Key idea: Architecture is the most visible choice and among the least consequential. Input representation, label definition, validation scheme and latency budget each move results more, and each is decided before a network is chosen.

The next lesson takes the second of those, the label, and shows that the standard target in this field is mostly noise, in a way that is measurable and that accounts for a large share of the accuracy numbers people report.

Check your understanding

The lesson ends with a 5-question quiz. Take it in the player above to see your score.

  1. Why does the column ordering of a book snapshot matrix change results?
    • It affects memory layout and therefore numerical precision
    • A convolutional filter spanning adjacent columns may mix a price with a size, which are not commensurable
    • Exchanges publish columns in a fixed order that must be preserved
    • It determines the sequence length seen by the LSTM
  2. What is the baseline most often missing from published order book comparisons?
    • A larger transformer
    • A Hawkes process model
    • Gradient-boosted trees on well-constructed features with the same purged split
    • A linear model on raw prices
  3. Why does evaluation leakage make deep models look better relative to simple ones?
    • Leakage affects only sequence models
    • Deep models train on more data, so leakage is proportionally larger
    • Leakage inflates the majority-class baseline specifically
    • Leakage is structure, and higher-capacity models fit it more completely
  4. What makes cross-asset lead-lag relationships more durable than intra-book patterns?
    • They are enforced by arbitrage, so they rest on a mechanism rather than a statistical regularity
    • They involve larger price movements
    • They are observable only with Level 3 data
    • They operate at longer horizons where noise averages out
  5. A model has useful accuracy but takes 50 ms to run against a signal decaying over a second. What is the core problem?
    • The signal will have fully decayed before the model responds
    • Fifty milliseconds exceeds most exchange rate limits
    • Competitors acting in microseconds have already traded on the same mechanism
    • The model cannot be retrained fast enough to track the regime

Related lessons

AI
advanced

Evaluating a Book Model Honestly

If your cost per round trip equals the move you are trying to capture, you need 100 percent directional accuracy to break even. This lesson computes that hurdle, replaces accuracy with metrics tied to a tradeable decision, and covers the capacity and latency limits that decide whether a real edge is worth anything.

10 steps·~15 min
AI
advanced

Why Reported Order Book Results Do Not Replicate

At a one-event horizon, 92 percent of mid-price labels are exactly no-change, so a model that always predicts flat scores 92 percent accuracy. This lesson computes that baseline across horizons and works through the four mechanisms that turn a genuine measurement into a number nobody can reproduce.

10 steps·~15 min
AI
advanced

What Is Actually in an Order Book, and What a Model Can See

Before choosing an architecture you have to decide what the input is, and an order book offers several incompatible representations that are not equally informative. This lesson covers what each data level contains, why raw prices are the wrong features, and the representation choices that decide more than the model does.

10 steps·~15 min
AI
advanced

Market Making: Inventory, Adverse Selection, and What RL Adds

A market maker quotes both sides and profits from the spread, but every fill leaves an unwanted position and the counterparties who trade most eagerly are the ones who know something. This lesson simulates the inventory-skew trade-off, showing a 63 percent cut in exposure for 2.5 percent of profit, and locates where a learned policy genuinely helps.

10 steps·~15 min