Finance and economics
Machine learning for market making
Market makers use machine learning to predict short-term mid-price moves from order-book imbalance, to estimate fill probabilities for quotes, and to learn quoting policies with reinforcement learning in a simulator. The prediction is one input to a policy that also manages inventory, latency and fees.
How machine learning is used in market making
Predicting the next mid-price move
Market makers forecast short-term moves from the imbalance between buying and selling pressure at the best quotes. A linear model on order flow imbalance is a strong baseline before trying nonlinear models.
Real exampleThe price impact of order book events (Cont, Kukanov and Stoikov)Using NYSE data for 50 US stocks, found that over short intervals price changes are mainly driven by order flow imbalance, with a linear relation whose slope is inversely proportional to market depth.
Estimating fill probabilities
Whether a resting quote is filled, and how soon, decides whether a passive order is worth posting. Survival models estimate the distribution of time until fill from the state of the book.
Real exampleDeep attentive survival analysis in limit order books (Arroyo et al.)Proposed a convolutional-Transformer survival model that maps time-varying limit order book features to the distribution of fill times for limit orders placed at different levels of the book.
Learning quoting policies
Reinforcement learning agents learn where to place bids and offers by trading in a simulated market, with rewards that pay for the spread captured and penalise holding inventory.
Real exampleMarket making via reinforcement learning (Spooner et al.)Built a high-fidelity limit order book simulation and trained a temporal-difference reinforcement learning agent to make markets, with a custom reward function to control inventory risk.
Testing in market simulators
Learning by trading real capital is slow and costly, so agents are trained and tested in simulators where many other agents send orders to an exchange.
Real exampleABIDES market simulator (Byrd, Hybinette and Balch)An agent-based discrete event simulation environment designed for AI research in markets, able to simulate tens of thousands of trading agents interacting with an exchange agent.
Can you learn machine learning for market making?
Yes, though it is one of the most specialised areas of quantitative finance. You need programming, probability and a detailed understanding of limit order books first, then supervised learning for short-term prediction and reinforcement learning for quoting.
- Python for order book dataReconstruct order books from message data, compute spreads, imbalance and queue sizes, and handle event timing correctly.Learn it in Data Tools
- Probability and inventory modelsPoisson order arrivals, Markov chains and inventory risk, which classic market making models such as Avellaneda and Stoikov rely on.
- Supervised learning for short horizonsClassify the next mid-price move from imbalance features, with walk-forward validation and a baseline that predicts no change.Learn it in Machine Learning
- Deep learning for order book sequencesConvolutional and recurrent networks that read recent book states, compared with the linear imbalance model.Learn it in Deep Learning
- Reinforcement learning in a simulatorTrain a quoting agent in a simulator such as ABIDES, with rewards that penalise inventory, and compare it with a fixed-spread rule.
Moving into machine learning for market making
If you already work in the field
Traders and market structure specialists know quoting, inventory, fees and adverse selection from experience. Add Python and statistics, then reproduce a published order flow imbalance or fill-probability study on public data before building learning-based components.
If you come from data science or ML
ML researchers should learn limit order book mechanics, exchange fees and rebates, latency and the economics of adverse selection. Classic models such as Avellaneda and Stoikov show what a learned policy has to improve on.
Roles that do this workQuantitative traderQuantitative researcher, market makingAlgorithmic trading developerLow-latency software engineer
Tools you will use
| Tool | What you use it for |
|---|---|
| HftBacktest | Backtest quoting strategies on order-book data with queue position and latency modelled. |
| pandas | Reconstruct order-book snapshots and compute imbalance and spread features. |
| scikit-learn | Fit classifiers for short-horizon mid-price direction. |
| PyTorch | Train sequence models such as convolutional or recurrent networks on order-book snapshots. |
| Gymnasium | Wrap a quoting simulator as a reinforcement learning environment. |
| Stable-Baselines3 | Train reinforcement learning agents for quoting and inventory control in that environment. |
Public data to practise on
- LOBSTER sample files: Free sample message and multi-level order-book files for Nasdaq stocks, for building imbalance features and mid-price labels.
- FI-2010 limit order book benchmark: Normalised limit order book data for five stocks with mid-price movement labels, published under a CC BY licence for benchmarking forecasts.
Your first project
Download a LOBSTER sample file, compute best-level order-book imbalance, predict whether the mid-price moves up or down over the next 10 events with logistic regression, and compare it with a no-change baseline using balanced accuracy.
Common questions
What does a market maker do?
A market maker continually quotes prices to buy and sell, earning the spread in exchange for providing liquidity and bearing inventory risk. The main risks are holding a position when prices move and trading with better-informed counterparties.
Is reinforcement learning used in market making?
It is an active research area, usually tested in simulators because exploring with real capital is expensive. Published work trains agents to set quotes while controlling inventory; how firms use it in production is rarely disclosed.
Why does latency matter for machine learning in market making?
A prediction that arrives after the market has moved is of no use, so models must run within strict time budgets. This favours small, fast models and careful feature engineering.
Where can I get order book data to practise?
Public options include the FI-2010 benchmark, LOBSTER sample files for NASDAQ stocks and public cryptocurrency exchange feeds. Check each source's licence before use.
Courses for these skills
- Practical Machine Learning in PythonBuild baselines and time-aware comparisons.51 published lessons · more lessons in production
- Deep Learning with PyTorchBuild neural policy and optimisation foundations.Syllabus available · lessons open as produced
- Maths for Machine LearningConnect objectives, state variables and optimisation.26 published lessons · all planned lessons open
New to programming or maths? Start with Python, or follow the machine learning path in order. Published lessons are free to read; compare Free and Pro.