The Market Making Book

17. Crypto Market Making in Practice: From Signal to Live Bot

Everything so far, assembled into one reproducible workflow — following a real study (Stoikov et al., Cornell, 2024) that took a market-making bot from candlestick data to live trading on perpetuals, and published every step.

Part IV · Chapter 17

Why crypto is the practice arena

If Part II is the theory and Part III the terrain, crypto is where an independent operator can actually train: markets run 24/7, perpetual futures give you hundreds of liquid instruments with published funding and fees (Chapters 11–12), historical candle and book data are free, and the open-source tooling is mature. The workflow below is not hypothetical — it follows, step by step, a Cornell Financial Engineering study that built, backtested, and live-traded exactly this stack, so every claim in this chapter has a source you can replicate.

Step 1 — Choose a universe, then cluster it

Start with the top ~30 coins by market cap that have perpetual contracts — large caps for liquidity, perps for shorting and leverage. Then compute the correlation matrix of their returns and cluster: the coins group naturally into families (Layer-1s like BTC/ETH/SOL, meme coins like DOGE/PEPE, DeFi tokens, utility tokens). The clusters matter for two reasons: diversification (thirty bots on thirty correlated coins is one bot with 30× leverage) and calibration (a meme coin and a Layer-1 need different spreads — Step 3 quantifies exactly how different).

Step 2 — Mine a signal from the candles you already have

A market maker's quotes need a center — Chapter 15's entry #8. The study's pool of candidate signals was built from nothing more exotic than 1-minute candlestick data: candle shape, local trend, and volume features. The winner is embarrassingly simple:

Bar Portion (Stoikov et al., 2024) BPt = ( Closet − Opent ) / ( Hight − Lowt ) What the symbols mean Opent, Closet, Hight, Lowt — the four prices of the current candle (Chapter 2)  ·  BPt — the candle's body as a fraction of its full range, with sign: +1 means the bar closed at its very top (a full-body green candle), −1 closed at its very bottom, 0 means the close landed back where it opened. In words: how much of this minute's range did the move actually keep?

The empirical finding, consistent across the 30-coin universe: Bar Portion mean-reverts. A bar that closes pinned to its high (BP near +1) tends to be followed by a down move, and vice versa — so the quoting engine leans against the last bar's push. Feel the signal:

interactive — the bar portion signal
Bar Portion
Signal says
Drag the slider to reshape the candle. A strong green bar (BP → +1) pushes the signal bearish — the next bar statistically gives some back — so the quoting engine shifts its reference price down a touch: the ask gets a little more eager, the bid a little more shy. A doji (BP ≈ 0) says nothing and the quotes stay centered. This one number, computed from data every platform gives away, beat the venerable MACD as a quote anchor in the study's live test.

Before trusting any signal, run quintile analysis — the study's filter, and a tool you should steal: sort all historical bars into five buckets by the signal's value, and compute the average next-bar return per bucket. A real signal shows a staircase (monotonically rising or falling returns across the buckets); a junk signal shows noise. Bar Portion produced a clean decreasing staircase on 73% of the universe. MACD — the default anchor in off-the-shelf bots — showed no consistent pattern at all, which is exactly why measuring beats assuming.

Step 3 — Calibrate spreads to volatility (a rule you can keep)

The study then optimized quoting parameters per coin (with Optuna, a standard hyperparameter-search library) and regressed the optima against each coin's volatility. Two findings, one of them a gift:

The spread-calibration rule of thumb optimal spread ≈ 4–5 × monthly volatility What the symbols mean spread — both the start spread (your first quote's distance from the reference price) and the step spread (the gap to each additional quote level behind it), each expressed in %  ·  monthly volatility — the standard deviation of the coin's returns over a month, in %. The linear fit was strong (R² ≈ 0.8) across all 30 coins — a rare case of one dial calibrating an entire universe. The second finding is the warning attached: optimal stop-loss and take-profit barriers showed no relationship with volatility at all (R² ≈ 0) — those you tune per market, from data (Chapter 16's triple barrier).
interactive — one dial: volatility sets the spread
Suggested start spread
Suggested step spread
Reading
Each dot is one coin from the study's universe: its monthly volatility against its Optuna-optimized spread, with the fitted 4–5× band. Slide the volatility to place your coin on the line and read off a starting spread — a calm Layer-1 wants tight quotes, a meme coin wants several times wider. This is Chapter 6's γσ² intuition wearing work clothes: volatility prices the spread, here measured rather than derived.

Step 4 — Backtest honestly, then paper-trade, then go tiny

The pipeline's discipline is the graduation ladder, each rung cheap to fail on:

  • Backtest with fees you'll actually pay. At 1-minute rebalancing, transaction costs dominate: the study deliberately backtested at 0.06% per trade — worse than its real 2×0.02% live costs — so that reality could only surprise it pleasantly. Its SOL backtest lost −0.14%; the same configuration live made +0.26%. The lesson is not "live is better": it's that the backtest-live gap is real, runs in both directions, and only a conservative cost assumption keeps it survivable.
  • Paper-trade the mechanics. Hummingbot's paper mode runs any strategy against live books with fake balances — the cheapest way to discover latency, partial fills, and connector quirks. (Its docs are honest: paper fills are optimistic, since your orders don't really consume liquidity.)
  • Go live small, A/B, one variable at a time. The study's final exam: same coins (SOL, DOGE, GALA), same risk settings, 24 hours, two bots — one anchored on MACD (pmm_dynamic), one on Bar Portion. The BP bot was profitable where the MACD bot lost. One day proves nothing statistically — but the method (identical settings, one changed variable, real money, small size) is the only honest final exam a strategy gets.

The toolbox, mapped

  • Hummingbot — the deployment layer: V2 controllers (pmm_simple, pmm_dynamic, xemm_multiple_levels) for quoting and cross-exchange hedging, paper mode, ~50 exchange connectors. Write your signal as a controller that shifts the reference price — that's all "PMM BP" is.
  • hftbacktest — the research layer: open-source, tick-level backtesting with queue-position modeling, and a worked GLFT-on-crypto tutorial; where Chapter 15's #3 stops being algebra.
  • Nautilus Trader — the serious-replay layer: event-driven backtests on full L2 book deltas with queue-aware fill models, and the same code runs live. (It's also the tool with a real Polymarket adapter — binary options as first-class instruments — which is why Part V's proposals test there.)
  • Optuna — the calibration layer: parameter search over spreads and barriers, per coin, against your backtests.

What this chapter deliberately did not promise

No claim here says these numbers will hold when you run them — signals decay, the 4–5× coefficient will drift, and a 24-hour live test is an existence proof, not an expected return. Two standing warnings from the literature: plain grid strategies have provably zero expected return without a directional or volatility edge (they harvest chop until a trend harvests them — Chapter 15, entry #4), and every backtest inherits its simulator's blind spots (Chapter 15, entry #7). What does transfer is the workflow: universe → measured signal → vol-calibrated spreads → pre-committed barriers → paper → tiny live A/B. That loop, run patiently, is how a practitioner gets real.

The practicum in one lineMeasure the signal (quintiles), let volatility set the spread (4–5× monthly vol), let data set the barriers (not vol!), pay pessimistic fees in the backtest, and graduate one rung at a time: backtest → paper → tiny live A/B. Every step of this chapter is reproducible with free tools and free data.

On this page

GitHubGitHub repository