Day 53: Spread Logic
Calculating the Bid-Ask Crossing Cost
Before a single order is placed, the market already has its hand in your pocket. The bid-ask spread is not a footnote — it is the first tax on every trade.
Contents
The “Mid-Price” Trap
A junior engineer builds their first backtester. They pull OHLCV data, compute signals, and simulate fills at the
closeprice. When that feels too optimistic, they graduate to the “sophisticated” version:(bid + ask) / 2— the mid-price.
This is a career-ending pattern in production.
Here is the P&L math that gets ignored:
Naive P&L per trade = (exit_mid - entry_mid) × size
Real P&L per trade = (exit_bid - entry_ask) × size
The delta between those two expressions is the bid-ask spread crossing cost. On a liquid name like SPY it might be 0.5 bps, but on a mid-cap equity at 3:45 PM, it can be 30+ bps. If your strategy edge is 8 bps, you are systematically losing 22 bps per round-trip. Your backtest shows alpha. Live trading shows ruin.
The failure is not the mid-price shortcut itself — it is that the system has no model for crossing cost whatsoever. When you go live, every market_order fires and eats the full quoted spread, plus slippage, plus market impact. By the time you notice the P&L drift, you have burned your paper trading allowance and built zero intuition for why.



