Market making bot explained: earning the spread, fearing the inventory

A market making bot doesn't bet on direction — it quotes both a buy and a sell price and earns the spread between them, over and over. It's how exchanges get liquidity and how some of the most consistent trading businesses make money. But "earn the spread" hides two predators: inventory risk (the market runs while you're holding) and adverse selection (you only get filled when you're wrong). This guide explains how market making works and why it's deceptively hard.

On this page
  1. The core idea
  2. Earning the spread
  3. Inventory risk
  4. Adverse selection
  5. Skeleton quote logic
  6. Who can do it

The core idea

Post a bid below the mid-price and an ask above it. If both fill, you bought low and sold high, pocketing the spread — direction-neutral. You're a tiny liquidity provider, the same role the exchange's professional market makers play, just smaller.

Earning the spread (and the rebate)

Because your orders add liquidity, you trade as a maker — often earning a rebate or paying a reduced fee. On a high-volume venue the rebate alone can be a meaningful part of the edge.

mid-price ASK (sell here) BID (buy here) the spread = your edge
Quote both sides around the mid-price; capture the spread when both fill. The art is staying filled on both sides without accumulating a one-way position.

Predator 1 — inventory risk

The fantasy is both sides filling evenly. Reality: in a trend, only one side fills. The market rallies, your asks get hit, and you're left short into strength — or it dumps and your bids fill, leaving you long into a crash. You now hold inventory with directional risk you never wanted.

Inventory is the killer

A market maker's nightmare is a one-way market. Real bots skew their quotes — widen or pull the side that's accumulating, lean prices to offload inventory — so they don't get run over. The classic Avellaneda–Stoikov model formalizes exactly this skew.

Predator 2 — adverse selection

Worse: you tend to get filled precisely when you're on the wrong side. Informed traders hit your stale quote just before the price moves their way. So your fills are biased toward losers — the spread has to be wide enough to pay for this "toxic flow."

Skeleton quote logic

python · market_maker.pydef quote(mid, inventory, target=0):
    base_spread = 0.001 * mid
    # skew quotes to push inventory back toward target
    skew = (inventory - target) * skew_factor
    bid = mid - base_spread - skew
    ask = mid + base_spread - skew
    return bid, ask   # post both, post-only (maker)

Who can actually do this

Market making rewards low latency, low fees (or rebates), deep capital and disciplined inventory control. It's the natural home of the maker-style scalper, and the realistic version of "the bot that makes a little, often." For most retail traders, a simple maker bot on a liquid pair with strict inventory limits is the entry point — but never confuse earning the spread with earning it risk-free. Test how inventory swings hit your equity, and size with the position calculator.

Not financial advice. This content is educational. Automated and algorithmic trading carries a real risk of financial loss. Never trade money you cannot afford to lose. Review the SEC investor.gov and CFTC resources before trading.

Frequently asked questions

What does a market making bot do?

It quotes both a buy price below the mid and a sell price above it, earning the spread when both fill. Unlike directional bots, a market maker doesn't bet on which way price moves — it profits from providing liquidity and capturing the bid-ask spread, often plus a maker rebate.

What is inventory risk in market making?

Inventory risk is being left holding a one-sided position when only one side of your quotes fills — for example getting left long after your bids fill during a sell-off. The market then moves against your unwanted inventory. Real market makers skew their quotes to push inventory back toward neutral.

What is adverse selection for a market maker?

Adverse selection means you tend to get filled exactly when you're on the wrong side, because informed traders hit your stale quote just before price moves their way. Your fills are biased toward losing trades, so the spread must be wide enough to compensate for this toxic flow.

Can a retail trader run a market making bot?

Yes, on a small scale with a maker bot on a liquid pair and strict inventory limits, but it's harder than it looks. Market making rewards low latency, low fees or rebates, and disciplined inventory control. Without those, adverse selection and inventory risk erode the spread you capture.

MB

Mustafa Bilgic

Algorithmic trading practitioner · Founder, AITradingBot.us

Mustafa builds and backtests automated trading systems and writes about them without the hype. Every tool on this site is free and runs entirely in your browser.