Skip to content
Projects / Phase 4.2 · Capstones

Execution replay and transaction-cost diagnostics (Coinbase BTC-USD)

This project replicates Cont, Kukanov & Stoikov (2014) and tests Almgren & Chriss (2001) on 69 full sessions of Coinbase BTC-USD.

Background

When a fund or trading desk needs to buy or sell more than the best quotes offer, an execution algorithm decides how to work the order: all at once, evenly over time (TWAP), as a share of market volume (POV), or on an Almgren–Chriss schedule that trades market impact against price risk. Transaction cost analysis (TCA) then measures what the order cost against the price when it arrived.

Measuring that needs the full order book, since the cost of a trade depends on the liquidity resting at each price when it arrives. Order-flow imbalance, the gap between buying and selling pressure at the best quotes, explains a sizeable share of short-term price moves and links impact to the depth of the book.

Why build it

This quant developer project is aimed at execution quant and trading research engineer roles, which are built around market, order and execution data, simulation, liquidity and impact. It asks a head of trading how to work spot-bitcoin parent orders on Coinbase, and whether spreading them over time is worth the extra price risk.

The learner rebuilds the Coinbase BTC-USD book from every level-2 update in Tardis.dev data and replays parent orders under several schedules, with an order state machine, latency stress and feed failures. The engineering gets as much weight as the cost analysis, because a desk can only trust TCA that rests on a clean, recoverable replay.

Headline result

An execution replay comparing immediate, TWAP, POV and Almgren–Chriss schedules. For orders up to 10 BTC, sending at once costs 0.56–3.36 bp with far less variance than TWAP, and the assumed 5 bp taker fee is larger than the impact of every order size.

Figures

  • Mean implementation shortfall with 95% error bars for six execution schedules at 0.5, 2 and 10 BTC, evaluation sessions
    Sending at once cost 0.56–3.36 bp with tight error bars; even ten-minute slicing (TWAP) averaged less but carried 8–17 bp of price risk.
  • Cumulative session cost of always-TWAP, always-immediate and the monthly desk rule for 0.5, 2 and 10 BTC orders, 2023–2026
    The monthly review rule tracked always-immediate and avoided time-slicing’s price-risk swings, but never beat simply sending every order at once.
  • Median cost of walking the Coinbase BTC-USD book for an immediate order, by order size and year, 2021–2026
    Cost rises less than linearly with size, and the book has held about 3–4 bp of liquidity for a 10 BTC order in every year.
  • Distribution of half-hourly R² of 10-second price changes on order-flow imbalance, and price impact against book depth
    Order-flow imbalance at the best quotes explains 27% of 10-second price moves and 42% over ten levels; impact falls as depth rises.

Data used

  • Tardis.dev Coinbase BTC-USD level-2 book updates, trades and quotes: 69 monthly sessions, 2021–2026

Topics covered

  • Execution algorithm project
  • TWAP, POV and Almgren–Chriss schedules
  • Transaction cost analysis (TCA)
  • Market impact and slippage
  • Order-flow imbalance
  • Order book replay and latency
  • Tardis.dev Coinbase order-book data
  • Execution quant project

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