Skip to content
Projects / Phase 4.1 · Quick Wins

Order-Book and Slippage Calculator

Before a bitcoin order is sent to Coinbase, what will it cost against the mid, what drives that cost (spread, depth or fee), and would splitting it over the next minute be cheaper?

Background

A market order fills against the orders resting in the limit order book. A small order may fill at the best price. A larger one walks the book through worse prices, and the gap between its average fill price and the mid-price is slippage. Exchange fees come on top.

Trading desks estimate this cost before each order. The estimate sets the portfolio manager’s expectations and helps decide between trading at once and spreading the order over time. It also becomes the baseline the desk’s execution quality is judged against afterwards.

Why build it

This quant finance project builds a pre-trade slippage calculator on real Coinbase BTC-USD order-book snapshots. It asks what a bitcoin order of up to 1 BTC will cost against the mid, whether that cost comes from the spread, the depth of the book or the fee, and whether splitting the order over the next minute would be cheaper.

Market impact and transaction cost analysis (TCA) are core skills for execution quants and crypto trading desks. The project also tests how far a polled snapshot of the book can be trusted, a question that returns in any execution algorithm built on the same data.

Headline result

A pre-trade slippage calculator. A 0.5 BTC market order walks 12 levels for 0.66 bp of impact, while the taker fee is 4–60 bp: 6–90× the book cost. Splitting the order only helps the part that was already small.

Figures

  • Displayed BTC depth by distance from mid on each Coinbase book side, and impact cost against order size
    A 0.5 BTC buy walked 12 levels for 0.66 bp; the taker fee of 4–60 bp is 6–90 times the cost of crossing the book.
  • Cost of a 1 BTC buy and sell, immediate versus split over ten snapshots, broken into impact, drift and penalty
    Splitting over one minute cut buy impact from 0.80 bp to 0.27–0.41 bp, but price drift over that minute has a 3 bp standard deviation.

Data used

  • Coinbase BTC-USD level-2 order book: ten snapshots over one minute
  • Coinbase daily candles for realised volatility
  • Coinbase published taker fee tiers

Topics covered

  • Slippage calculator
  • Walking the limit order book
  • Market impact and execution cost
  • Spread, depth and taker fees
  • Order splitting vs immediate execution
  • Transaction cost analysis (TCA)
  • Coinbase BTC-USD order book data

Members open the full write-up, notebook, tested code and data in the project reader.