What a market making bot actually does

At any moment an order book has a best bid b and a best ask a, with the mid price m = (a + b) / 2 and a spread s = a − b. A market making bot continuously posts limit orders inside that spread: a buy at m − δ and a sell at m + δ for some δ < s/2. When both fill, the bot collects per unit traded.

The strategy is unromantic and structurally profitable: any market with a positive bid-ask spread has a market maker getting paid to provide liquidity into it. The engineering challenge is not finding alpha; it is preventing inventory blow-ups and surviving regime changes.

The four real strategies

StrategyHow it worksWhere it works
Symmetric quotingPost buys and sells equidistant from mid, fixed spread.Stable pairs, low volatility windows.
Inventory-aware quotingSkew quotes against current position to nudge inventory toward zero.Default for any retail market maker.
Volatility-aware quotingWiden spreads when realised volatility rises; tighten when calm.Crypto. Volatility regime shifts every few hours.
Cross-venue market makingQuote on venue A, hedge fills against the price on venue B.Pairs that trade on multiple exchanges with different liquidity profiles.

For a retail market making bot, the practical answer is "all four, blended." The symmetric core sets the baseline; inventory-skew keeps positions from runaway; volatility-awareness keeps you alive during news; cross-venue arbitrage closes inventory quickly when you accumulate too much.

Hello-world in 50 lines

import time, ccxt

ex = ccxt.binance({"apiKey": KEY, "secret": SEC, "enableRateLimit": True})
PAIR = "BTC/USDT"
SPREAD = 0.0008      # 8 bps half-spread
MAX_INVENTORY = 0.5  # BTC
SKEW = 0.5           # how aggressively inventory pulls quotes

def quote_loop():
    while True:
        book = ex.fetch_order_book(PAIR, limit=5)
        mid = (book["bids"][0][0] + book["asks"][0][0]) / 2
        pos = ex.fetch_balance()["BTC"]["free"]   # current inventory

        skew = SKEW * (pos / MAX_INVENTORY)        # in [-1, 1]
        bid_px = mid * (1 - SPREAD * (1 + skew))
        ask_px = mid * (1 + SPREAD * (1 - skew))

        cancel_open_orders(PAIR)

        if pos < MAX_INVENTORY:
            ex.create_limit_buy_order(PAIR, 0.01, bid_px)
        if pos > -MAX_INVENTORY:
            ex.create_limit_sell_order(PAIR, 0.01, ask_px)

        time.sleep(2)

That is a working market making bot. It is also a fragile one: a real production bot is the same shape with five layers of risk management bolted on. We turn to those next.

The five layers of production risk management

Market making is the strategy class where boring engineering produces alpha. Each item below is the difference between a working bot and a busted one.

  • Inventory caps. Hard. Per-pair, per-side, per-day. When your inventory hits a cap, you stop quoting on that side. The bot is allowed to bleed inventory back to zero through the other side; it is not allowed to keep adding.
  • Volatility-adaptive spreads. Track realised volatility on a rolling 10-minute window. Multiply your base spread by 1 + 5 × σ_recent / σ_baseline. Calm markets get tight quotes; stormy markets get wide ones.
  • Drawdown circuit breaker. Halt all quoting if PnL hits a hard floor: typically -2% of allocated capital intra-day. Restart manually after reviewing what happened. Auto-restart is a foot-gun.
  • Latency monitor. If a single order takes longer than 500ms to acknowledge, halt. Slow venue = stale quotes = adverse fills.
  • Fee-aware net edge. Maker rebate matters. On Binance you earn ~0.01% as a maker; that is the difference between a +5% and -3% strategy. Verify your account is in the maker tier and that your orders are actually posting as maker, not crossing the spread.

Where retail can actually win in 2026

Three categories where the spread genuinely is not arbed flat by professionals:

Tier-2 CEX altcoin pairs

OKX, Bybit, KuCoin altcoin pairs with $200k–$2M daily volume. Spreads are 20–80 bps versus 1–5 bps on top BTC/USDT. The pros mostly stay in BTC/ETH/SOL; the rest of the book is yours if you can manage inventory.

Prediction markets

Polymarket and Kalshi long-tail markets routinely have YES quotes 10–20 cents wide. A bot that respects the structural risks (resolution ambiguity, illiquid expiry) can get paid for providing liquidity there. The quotes are wide partly because those risks are real, and returns are not guaranteed.

DEX liquidity provision

Concentrated-liquidity AMMs (Uniswap v3 / v4) are market making in disguise: you are quoting both sides of a price range and earning fees as the price oscillates. Same risk profile, different interface. The math is identical; the failure modes (impermanent loss) are the same as inventory skew on a CEX.

Where AI agents help (and where they don't)

The per-quote decision is a deterministic algorithm. Calling Claude to decide whether to post a $0.01 bid is wasteful and adds 800ms of latency you cannot afford.

Where an agent earns its keep is in the meta-decisions:

  • Pair selection. Read news + on-chain flow + funding rates, and decide which 5 pairs to market-make today. This changes monthly; an agent loop can stay current better than a static config.
  • Spread tuning. Read the same signals and propose adjusted spreads. The agent does not place orders; it adjusts the parameters the deterministic bot consumes.
  • Halt decisions. Should the bot pause around the FOMC announcement, the inflation print, the Coinbase listing? An agent reading scheduled events and current conditions is materially better than a calendar.

In NickAI, the market making node consumes parameters set by an agent loop running over news and on-chain data. The bot is fast and dumb; the parameters are slow and smart. That separation is the whole point.

What you graduate to from py-script

The 50-line hello-world handles a single pair on a single venue. Production typically wants:

  • 5–20 pairs on 2–4 venues simultaneously, with shared inventory accounting.
  • Cross-venue inventory netting (long BTC on Binance, short BTC on Bybit = flat).
  • Dynamic capital allocation across pairs based on realised PnL.
  • News and event awareness in the parameter layer.

That is roughly six months of engineering done well, or one config file on an agent runtime that ships those primitives. Both are valid; the build-vs-buy line falls where you want to spend your engineering bandwidth.