Order Book Features For Machine Learning
Raw book snapshots are too high-dimensional and too correlated to feed a model directly. A handful of engineered features — imbalance, spread, slope — capture most of what actually predicts short-term price moves.
Prerequisites: Depth At Touch And The Shape Of The Book
A raw book snapshot — every price and size at every level, on both sides — is dozens of correlated numbers that change on every message. Feeding that directly into a model wastes most of its capacity re-learning that "bid size at level 1" and "bid size at level 2" move together. Feature engineering compresses the book into a smaller set of numbers that each capture a distinct, economically meaningful signal.
The core features, computed on a real book
Book: bid 250 @ 99.98, offer 180 @ 99.99, next levels bid 400 @ 99.97, offer 220 @ 100.00.
Spread: — how expensive it is to trade immediately.
Order-flow imbalance at touch: — more resting size on the buy side, a mild lean toward price rising (see The Microprice for why).
Multi-level imbalance (using two levels each side): total bid size , total offer size , giving — slightly stronger than the touch-only reading, suggesting the buy-side lean isn't just a touch-level fluke.
Book slope (how fast size grows moving away from the touch): bid size roughly doubles from level 1 to level 2 (250→400, +60%), offer size barely grows (180→220, +22%) — a steep bid slope relative to the offer slope again points the same direction, toward buy-side support.
Each of these is a single number, cheap to compute on every book update, and together they capture most of what a deep model trained on the raw levels would otherwise have to rediscover on its own.
Good order-book features aren't the raw levels — they're ratios and differences (imbalance, spread, slope) chosen because each isolates one specific way the book can be lopsided, which is what actually predicts short-horizon moves.
Where it's used. These features are the standard inputs for short-horizon mid-price direction models — predicting whether the next move is up, down, or flat over the next few hundred milliseconds to a few seconds. They're also used as inputs to fill-probability models for resting limit orders, and as sanity-check features alongside end-to-end deep models trained on raw book images, which tend to rediscover imbalance and slope as their most important learned signals anyway — see Deep Learning On Limit Order Books.
Engineered features computed at a single snapshot are noisy and mean-revert fast — imbalance flips constantly as small orders arrive and cancel. Most working models use several snapshots' worth of history (recent changes in imbalance, not just its current level), and every feature needs label alignment carefully checked against Label Latency and Delayed Feedback so the model isn't accidentally trained on information from after the prediction point.
Practice in interviews
Further reading
- Kercheval & Zhang (2015), Modelling High-Frequency Limit Order Book Dynamics with Support Vector Machines
- Sirignano & Cont (2019), Universal Features of Price Formation in Financial Markets