Sequence Models for Trade and Quote Arrival
Trades and quotes arrive as an ordered sequence in time, and models built to respect that order — like recurrent networks or transformers — can capture patterns that a model treating each observation as independent would simply miss.
A simple model predicting the next trade's price impact might feed it a snapshot of current features — bid-ask spread, order book depth, recent volume — treating each moment as independent of the ones before it. But order flow has memory: a burst of aggressive buying tends to be followed by more of the same for a short while, and the shape of recent quote and trade history often predicts what comes next better than any single snapshot does. Sequence models — recurrent neural networks, or more recently transformer-style attention models — take a whole window of recent trades and quotes as input, letting the model learn patterns in how that sequence unfolds rather than compressing it down to a handful of summary statistics first.
The tradeoff is cost and data hunger: sequence models need much more training data and computation than a snapshot-based model, and the extra complexity only pays off if the underlying process really does have meaningful short-term memory worth capturing.
Sequence models process a window of recent trade and quote history directly, capturing short-term dependencies in order flow that a model built on a single snapshot of current features cannot see.
A model fed the last 50 trades in sequence can pick up on a building imbalance of buyer-initiated trades that a model fed only the current bid-ask spread and last trade price would completely miss.
Related concepts
Practice in interviews
Further reading
- Cartea, Jaimungal, Penalva, Algorithmic and High-Frequency Trading (ch. 2)