What Are Market-Making Algorithms?
Learn what market-making algorithms are, how they set bid and ask quotes, manage inventory risk, and handle adverse selection in electronic markets.

Introduction
Market-making algorithms are automated systems that continuously post buy and sell quotes, trying to earn the bid-ask spread while controlling the risk of being run over by the market. That sounds simple until you look at the mechanism. Every quote is both an opportunity and a liability: if your bid is hit, you become longer; if your ask is lifted, you become shorter; and if the price moves before you can rebalance, the spread you earned can be much smaller than the inventory risk you took on.
This is why market making is best understood not as “always quote both sides,” but as a dynamic balancing problem. The algorithm is trying to trade off three things that pull in different directions. It wants to quote tightly enough to get filled. It wants to quote cautiously enough to avoid accumulating dangerous inventory. And it wants to avoid being the stale quote that informed traders pick off when the market has already moved.
In electronic limit order books, this balancing act happens continuously. Exchanges match orders by explicit priority rules, often based on price and then time, so small changes in quote level or order replacement can alter execution probability. The result is that market-making algorithms are not just pricing models. They are control systems sitting inside a market microstructure: they observe the order book, choose quotes, monitor fills, update inventory, and react to exchange constraints, risk limits, and sometimes market stress procedures.
The central idea that makes the topic click is this: a market-making algorithm is a machine for converting inventory risk and execution uncertainty into a quoting rule. Once you see that, many design choices make sense. Why widen spreads in volatile conditions? Because fills are not equally valuable when inventory is already skewed. Why move both quotes off the mid-price? Because the algorithm has its own internal valuation once inventory matters. Why invest so much in kill switches and cancel-on-disconnect? Because a broken quoting engine can turn a spread-harvesting strategy into a runaway risk generator in seconds.
What optimization problem does a market‑making algorithm solve?
A human description of market making is straightforward: stand ready to buy at the bid and sell at the ask. But an algorithm cannot stop there, because where to place those quotes is the whole business. A quote placed too close to the market earns little per trade but fills often. A quote placed farther away earns more if executed but may rarely trade. The algorithm is therefore solving a repeated optimization problem: how much expected spread capture is worth how much execution risk and how much inventory risk?
That last part is the defining complication. If fills arrived in perfectly balanced pairs, market making would be much easier. In reality, fills are lumpy and one-sided. An algorithm might buy repeatedly in a falling market or sell repeatedly in a rising one. The longer it holds inventory, the more exposed it is to price moves unrelated to the spread it earned. This is why the classic quantitative framing treats market making as a control problem over terminal profit and loss, not a simple rule about always quoting symmetrically.
A canonical formulation comes from Avellaneda and Stoikov. In their model, the mid-price evolves as a stylized Brownian process, and the market maker chooses bid and ask quote distances from that reference price. Executions arrive randomly at rates that fall as quotes are placed farther from the mid. The market maker then maximizes expected utility of final wealth, which folds spread revenue together with dislike of inventory risk. The details are model-specific, but the structural lesson is broader: optimal quotes come from the interaction between how likely you are to trade and how painful inventory is if you do.
That framework also explains why market making differs from directional trading. A directional trader begins with a view about where price should go. A market maker begins with a willingness to trade on both sides, then modifies that willingness as its state changes. If inventory becomes too long, the algorithm’s internal value of another buy is lower than the public mid-price would suggest. If it becomes too short, the opposite happens. The algorithm is not claiming the market is wrong in an absolute sense; it is adjusting quotes because the next fill has different value to this portfolio.
How do reservation price and spread determine a market‑maker’s quotes?
| Quote axis | When used | Effect on fills | Inventory impact | Why choose |
|---|---|---|---|---|
| Shift center | Inventory skew present | Rebalances fills direction | Reduces same-side fills | Lower inventory risk quickly |
| Widen spread | High uncertainty | Lower fill rate overall | Slows inventory change | Compensate for selection risk |
| Skew size | Adjust size per side | Change traded volume bias | Gradual inventory steering | Fine-grained control, preserves queue |
The cleanest way to understand many market-making algorithms is to separate the decision into where to center quotesandhow wide to make them. In the Avellaneda–Stoikov setup, the first object is the market maker’sreservation price: the internal price at which the algorithm is indifferent, given its current inventory, between buying, selling, or doing nothing. This reservation price is not just the exchange mid-price. It is the mid-price shifted by inventory and by the remaining time horizon.
Intuitively, if the algorithm is already long, one more buy is less attractive and one more sale is more attractive. So its internal fair value moves below the public mid-price. If it is short, the internal fair value moves above the mid-price. In the stylized finite-horizon model, the shift grows with inventory and with the time left for risk to matter. That is an important idea even when the exact formula is not used in production: inventory changes the algorithm’s valuation, so rational quotes become asymmetric around the market.
The second object is the spread. A spread is compensation for supplying liquidity under uncertainty. If executions were guaranteed and harmless, the optimal spread would collapse toward zero under competition. But executions are selective: the orders most likely to hit you are often the ones with information or urgency. At the same time, the farther your quote is from the mid-price, the lower your fill probability. A practical market-making algorithm therefore uses a model of execution intensity (often written as a decreasing function of quote distance) to estimate how often a bid or ask will trade.
In the basic exponential-arrival version of the model, inventory shifts the center of the quote pair while the optimal spread width itself can be independent of current inventory. That result is specific to the assumption about arrival rates, so it should not be treated as a universal law. But it captures a useful design pattern. A strategy can manage inventory either by moving the whole quote pair away from the mid in an asymmetric way, or by explicitly widening one side and narrowing the other, or both. Different production systems implement this trade-off differently depending on the asset, tick size, and how execution probabilities are estimated.
Here is the mechanism in a simple narrative example. Suppose the mid-price is 100.00 and your algorithm starts flat. In a calm market it may quote 99.99 bid and 100.01 ask, expecting that the narrow spread gives reasonable fill odds. Now imagine several sell orders hit its bid, and it buys inventory repeatedly. The algorithm is long. At that point, another buy is less desirable than another sale. So instead of centering around 100.00, it may now behave as if its internal fair value is 99.98. Its new quotes might become 99.97 bid and 99.99 ask, or perhaps 99.98 bid and 100.00 ask with more size on the ask side. The exact numbers depend on the model, but the logic is stable: the algorithm is leaning toward reducing inventory, not because it has forecast a crash, but because its own risk state has changed.
Why are fill‑probability (execution) models critical for market making?
| Model type | Fill probability vs distance | Optimal spread | Inventory control | Main risk |
|---|---|---|---|---|
| Gentle decay | Slow decline with distance | Wider spreads acceptable | Easier unwind via spreads | Overconfidence if mis‑specified |
| Steep decay | Rapid drop with distance | Tighter spreads required | Needs aggressive hedging | Becomes irrelevant when stepped back |
| Queue-aware | Depends on queue position | Tick‑aware spreads | Use replacements and priority | Complex calibration needs |
A market-making algorithm lives or dies by its estimate of fill probability. This is the main place where elegant theory meets stubborn microstructure. The algorithm does not choose profits directly; it chooses quotes, and the market decides whether those quotes trade. That is why the arrival-rate function matters so much in formal models and why empirical calibration matters so much in production.
In the classic setup, buy and sell market orders arrive according to point processes, with intensity decreasing as the quote is posted farther from the reference price. Avellaneda and Stoikov connect these intensities to empirical observations about market order size distributions and temporary price impact, arguing that exponential or power-law decay are plausible forms. The precise functional choice matters because it determines how costly it is, in expected fills, to step away from the market.
If your model says fill probability falls gently with distance, the algorithm will be comfortable quoting wider spreads. If your model says fill probability collapses quickly, the same spread width may make you irrelevant. Mis-specification here is dangerous in a subtle way. It does not merely change expected profit. It can distort the whole inventory policy because the algorithm may believe it can unwind risk more easily than the market actually allows.
This is also where neighboring ideas such as queue dynamics become relevant. In a real order book, execution probability is not only about quote distance from mid-price. It is also about priority. A quote at the best bid placed behind a long queue can behave very differently from a quote one tick lower with little queue ahead, especially when order cancellation and replacement reset time priority. Exchange rulebooks make this concrete: order ranking often depends on price category first and then time within category. So production market-making systems often augment simple distance-based fill models with queue-position models, microprice signals, short-term order-flow imbalance, and venue-specific matching rules.
Research on order-book dynamics points in the same direction. High-frequency limit-order-book models often approximate bid and ask queue evolution with stochastic processes that make it possible to estimate quantities such as the probability of an imminent price increase or the expected time until the next price move, conditional on current book state. For a market maker, that matters because the value of a posted quote depends not only on whether it fills, but on whether it fills before the price moves through it.
What is adverse selection in market making and how does it change quoting behavior?
| Flow type | Immediate P&L | Price follow-through | Mitigation |
|---|---|---|---|
| Informed flow | Spread earned but mark loss | High probability adverse move | Cancel or widen; shrink size |
| Urgent liquidity | Likely benign spread capture | Low short-term impact | Keep quotes; monitor signals |
| Noise flow | Small clean profits | Minimal follow-through | Maintain size; scale up |
A beginner’s intuition is that getting filled is good. A market maker’s intuition is more conditional: some fills are good, some are warnings. The key hidden risk is adverse selection. If informed or fast traders are more likely to trade against stale quotes just before the reference price moves, then a fill is not just spread capture. It may be the first step in an immediate mark-to-market loss.
This is why many market-making models and textbooks extend the inventory story to include short-lived alpha, market-order impact, and microprice effects. If aggressive buy orders tend to push the mid-price upward, then selling to those buyers at your ask may not be attractive unless the spread compensates you enough. Likewise, if the bid queue is vanishing and the ask queue is thick, the next mid-price change may be downward, making a passive buy less appealing even if the raw spread looks decent.
A useful analogy is insurance pricing. The spread is like the premium, and adverse selection is the fact that the counterparties most eager to trade with you may know more than you do. The analogy explains why the best-looking opportunities can be traps. It fails, however, if pushed too far, because market making happens on millisecond to minute horizons with strategic queue interactions, not in a static underwriting market. The point is simply that flow quality matters as much as flow quantity.
Mechanically, adverse selection pushes algorithms to do at least three things. They may skew quotes using short-term signals about likely mid-price movement. They may cancel or widen rapidly when the book changes in suspicious ways. And they may reduce size or step back entirely during fast conditions when their models lose confidence. These behaviors are not optional refinements. They are direct consequences of the fact that passive execution is not free money; it is a bargain with uncertain counterparties.
Worked example: how does a market‑making algorithm react to order flow and inventory?
Imagine an equity market maker in a highly liquid stock. The stock is trading around 50.00 with a one-cent tick. The algorithm begins the morning with zero inventory and a target of staying close to flat. It observes a balanced book, modest volatility, and no strong short-term directional signal. Under those conditions it posts 49.99 bid and 50.01 ask, perhaps with equal size on both sides. It is offering liquidity and hoping to earn one cent from each completed round trip.
Now a burst of selling hits the market. The algorithm’s bid fills several times, so it accumulates a long position. At the same time, the best bid queue weakens and recent market orders are predominantly sells. The algorithm responds in two layers. Because inventory is now long, its internal reservation price falls below the public mid-price; it would rather sell than buy. Because order flow looks toxic, it also becomes less willing to stand still at the old prices. So it may lower both quotes, reduce bid size, and keep a more attractive ask to encourage inventory reduction.
A few seconds later, volatility rises sharply and quote updates accelerate across venues. The algorithm’s infrastructure matters now as much as its pricing logic. If it loses connectivity, cancel-on-disconnect settings should attempt to remove resting orders. If messaging rates approach venue thresholds, throttles should not block cancellations, because being unable to cancel in a fast market is exactly when passive risk explodes. If position or loss limits are hit, a local risk layer may block new orders and trigger a kill switch for part or all of the strategy.
Notice what happened. The algorithm was not “predicting the future” in a grand sense. It was repeatedly translating state into action: current inventory, current queue conditions, current flow, current volatility, current operational health. This is the practical meaning of market making. The edge is not a single forecast. It is a disciplined loop that prices liquidity while surviving the fills it receives.
How do exchange rules, message limits, and operational controls change production market‑making systems?
The mathematical models are valuable because they make the trade-off legible. They force you to state what inventory costs, what executions are worth, and what state variables matter. But no production market-making system is just an HJB solution wired to a market data feed. Real systems must sit inside exchange protocols, message limits, order-priority rules, and operational safeguards.
Exchange documents make this concrete. Market makers on major venues are often expected to maintain continuous two-sided quotes in registered instruments, sometimes with explicit obligations around spread, displayed size, time at the inside market, or auction participation. That matters because the algorithm may not be free to step away whenever conditions are uncomfortable. In some products, designated liquidity providers receive fee benefits or rebates in exchange for quoting commitments, including separate treatment during stressed conditions.
Those obligations shape the algorithm. If the exchange measures quoting performance only for properly flagged messages, then order tagging is part of the strategy’s real economics. If order priority is reset when a displayed order’s working price changes or size increases, then quote management must account for the value of queue position. If special stressed-market or exceptional-circumstance regimes exist, the algorithm needs state-aware logic for those transitions rather than assuming one quoting policy fits all conditions.
This is also why pre-trade risk controls are not an afterthought. Broker-dealer market access rules in the United States require documented, pre-trade controls reasonably designed to limit financial exposure and ensure compliance. Exchange and industry guidance similarly emphasize localized pre-trade controls, message throttles, self-match prevention, cancel-on-disconnect, drop-copy reconciliation, and kill switches. For a market-making strategy, these are not bureaucratic accessories. They are part of the mechanism that keeps an updating quote engine from turning operational failure into market disruption.
What failure modes do market‑making algorithms show during market stress?
Market-making algorithms are often described as liquidity providers, which is true in normal conditions. But a deeper truth is that they provide liquidity conditionally. The condition is that their models, feeds, and controls still make sense. When those fail, liquidity can vanish quickly.
The flash crash findings are a vivid example of this dynamic. During the May 6, 2010 disruption, many liquidity providers’ automated systems triggered internal pauses based on price moves, feed disagreement, or risk limits. From the firm’s point of view, that behavior was defensive and often rational. From the market’s point of view, it meant many providers withdrew at once, leaving less resting liquidity exactly when it was most needed. This is not a contradiction. It is a structural feature of electronic market making: the same safeguards that protect firms can amplify collective withdrawal in stress.
The Knight Capital incident shows a different failure mode. There, the problem was not a market shock that made quoting unsafe, but defective deployment and inadequate controls that generated millions of erroneous orders. The lesson is not merely “test your software,” though that is true. The deeper lesson is that market-making algorithms are high-leverage systems in the engineering sense. They can send huge message volumes and change risk rapidly, so small control failures can scale into large financial and market consequences.
These cases clarify why robust firms treat market making as both a quantitative problem and an operational one. The pricing model may be elegant, but it must live inside deployment procedures, conformance testing, staged releases, real-time monitoring, alert escalation, and authority-separated kill mechanisms. In a fast market, the question is not only whether your quoting rule is optimal under the assumed model. It is whether the system can fail safely when the model, the code, or the market environment stops behaving as assumed.
Which simplifying assumptions do market‑making models make, and when do they break down?
The most influential market-making models rely on simplifying assumptions for tractability. A reference price may be modeled as Brownian motion. Utility may be exponential. Order arrivals may be Poisson with intensities determined only by quote distance. Quotes may be assumed continuously updateable at no cost. These assumptions are often reasonable as starting approximations, but each strips away something real.
Brownian price models miss jumps, regime shifts, and clustered volatility. Simple arrival models miss strategic and self-exciting order flow. Costless quote updating ignores message fees, throttles, and the economic value of queue priority. Finite-horizon utility formulations may not map cleanly to desks that run continuously with capital, inventory, and hedging constraints spanning many products. None of this invalidates the models. It simply tells you what they are for: they reveal structure, not full reality.
That structure is still useful. The idea of a reservation price survives model changes. The trade-off between tighter spreads and lower fill quality survives. The importance of calibrating execution probabilities survives. The need to integrate inventory, adverse selection, and operational control into a single decision process survives. In that sense, the core of market-making algorithms is more robust than any one equation.
Conclusion
A market-making algorithm is an automated quoting system built to earn spread revenue while staying alive to trade again. Its central problem is not merely posting two-sided quotes, but deciding how to place and update those quotes when execution is uncertain, inventory is risky, and the market may be better informed than you are.
The most useful way to remember the topic is this: market making works by turning state into prices. Inventory shifts the algorithm’s internal valuation. Execution models translate quote distance into fill odds. Adverse selection changes the value of a fill. Exchange rules and risk controls determine what the system can safely do in the real market. If you remember that mechanism, the rest of the field becomes much easier to understand.
Frequently Asked Questions
Because inventory changes the algorithm’s internal ‘‘reservation price,’’ a long position shifts the internal fair value below the public mid and a short position shifts it above, so the quote pair is recentered asymmetrically to encourage reducing the skewed inventory rather than trading exactly around the mid-price.
Because the algorithm only chooses quotes while the market decides whether they execute, errors in the fill‑probability model can distort expected profit and, more dangerously, the inventory policy - if the model overestimates fill odds the strategy may assume it can unwind risk faster than the market actually allows.
Execution probability depends not only on distance from mid-price but also on queue priority and short‑term order‑flow; a best‑bid order sitting behind a long queue can have much lower effective fill odds than a slightly worse price with little queue ahead, so production systems augment distance models with queue‑position and microprice signals.
Adverse selection means the counterparties most likely to hit your passive quotes often have information or urgency that predicts immediate price moves, so market makers respond by skewing quotes with short‑term signals, canceling or widening rapidly when the book looks ‘‘toxic,’’ and reducing displayed size during fast conditions.
Mathematical models like Avellaneda–Stoikov reveal the reservation‑price and spread tradeoffs, but their simplifying assumptions (Brownian reference price, chosen arrival‑rate functions, costless continuous quote updates) mean they are structural guides rather than turnkey production systems; real implementations must add exchange rules, message limits and operational safeguards.
In stress the normal safeguards that protect individual firms - automated pauses, kill switches, cancel‑on‑disconnect - can cause many providers to withdraw simultaneously and remove liquidity, and software or deployment failures (e.g., the Knight Capital incident) can instead create runaway quoting; both withdrawal and erroneous messaging are primary failure modes.
Exchange quoting obligations and venue rules can constrain when and how a market maker may step away (for example, requirements on spread, minimum size, or time at the inside), they affect whether messages count toward obligations (proper tagging), and exchanges can suspend or modify obligations during declared stressed or exceptional conditions.
Critical operational controls include pre‑trade limits, message throttles, cancel‑on‑disconnect, self‑match prevention, drop‑copy reconciliation, staged deployments, and kill switches, because market‑making engines can change risk and send large message volumes in seconds and therefore must be able to fail safely.
Widening spreads in volatile conditions is rational because volatility increases the cost of holding inventory and makes fills more likely to be adverse‑selection events, so a wider spread compensates for greater inventory and execution uncertainty.
Very sensitive: theoretical results (for example, the finding that optimal spread can be inventory‑independent) rely on particular arrival‑rate forms (exponential or specific power laws), so choosing or mis‑specifying the functional form and its parameters can materially change optimal quoting and inventory control.
Related reading