Quant Memo
Core

Normalising Order-Book Snapshots for Neural Models

Why raw limit order book snapshots need to be rescaled and structured before feeding them into a neural network, and the specific normalisation choices that make or break these models.

Prerequisites: Depth At Touch And The Shape Of The Book, Deep Models on Limit Order Book Data

Feed a neural network the raw numbers straight off an order-book feed — prices like $142.37, sizes like 14,200 shares, all changing scale from one stock to the next and one day to the next — and it will typically train badly or not at all. Neural networks are sensitive to the scale of their inputs: gradients get dominated by whichever feature happens to have the largest raw magnitude, regardless of whether that feature is actually the most informative one. Order-book snapshots need to be normalised into a consistent, scale-free representation before a network ever sees them.

Two kinds of scale to remove

The first problem is price level: a stock trading at $5 and one trading at $500 have wildly different absolute price ticks, so raw prices are meaningless across names and even across days for the same name after a split or a large move. The fix is to express every price in the snapshot relative to the current mid-price, usually in ticks or basis points away from it, so a level "2 ticks above mid" means the same thing whether the stock is at $5 or $500. The second problem is size scale: order sizes vary enormously across stocks by liquidity and across times of day, so raw share counts at each level get normalised by dividing by a rolling average size (say, the average total depth at that level over the past hour), turning "14,200 shares" into "1.3× the recent typical depth at this level" — a number that means roughly the same thing everywhere.

Structuring the snapshot

A full order-book snapshot is naturally a fixed-size grid: LL price levels on the bid side and LL on the ask side, each with a (relative price, normalised size) pair, repeated across a short window of past snapshots to give the network some temporal context. This grid structure is exactly why convolutional architectures work well here — nearby price levels and nearby time steps are meaningfully "adjacent" in the same way pixels are adjacent in an image, and a convolution can learn local patterns (like a thinning book near the mid) without needing a separate weight for every possible level and time.

Worked example: normalising one level

Raw snapshot: mid-price $100.00, best bid $99.98 with 8,000 shares, where the past hour's average size at that specific level has been 5,000 shares. The relative price, in ticks (assuming a $0.01 tick), is:

99.98100.000.01=2 ticks.\frac{99.98 - 100.00}{0.01} = -2 \text{ ticks} .

The normalised size is 8,000/5,000=1.68{,}000 / 5{,}000 = 1.6. So the raw pair ($99.98, 8,000 shares) becomes the normalised pair (2 ticks,1.6×)(-2\text{ ticks}, 1.6\times) — a representation that says "two ticks below mid, with 60% more size than usual sits here" and means the same thing whether this is a $20 stock or a $2,000 stock, on a quiet Tuesday or a volatile earnings day.

Raw snapshot \$100.02 — 6,000 sh \$100.00 — mid \$99.98 — 8,000 sh \$99.97 — 12,000 sh normalise Normalised grid +2 ticks — 1.2× 0 (mid) -2 ticks — 1.6× -3 ticks — 2.4×
Prices become distance-from-mid in ticks; sizes become a ratio to their own recent typical value — a scale-free grid the network can compare across stocks and days.

What this means in practice

Skipping normalisation is one of the most common reasons a deep order-book model looks fine in development on one liquid stock and then fails to generalise to a different stock or a different volatility regime — the network effectively memorised the specific price and size scale of the training data rather than learning shape and pattern. Normalisation constants (the rolling average size, the tick size) must themselves be computed only from past data at prediction time, exactly like any other feature, or the model quietly gains access to future information through the normalisation step itself.

Order-book snapshots must be converted to relative prices (ticks or basis points from the mid) and relative sizes (ratios to a recent rolling average) before being fed to a neural network, so the model sees a scale-free representation that means the same thing across stocks, price levels, and time.

Computing normalisation statistics like a rolling average size using data from after the prediction time leaks future information into every input — normalisation constants must be as strictly past-only as any other feature.

Related concepts

Practice in interviews

Further reading

  • Sirignano, Cont, Universal Features of Price Formation
  • Zhang, Zohren, Roberts, DeepLOB
ShareTwitterLinkedIn