Lesson 4 · 22 min

Microstructure & trading infrastructure

Exchanges, brokers, spreads, and how research simulation differs from live trading.

VenuesBrokersCostsFailure modes

Market microstructure is the mechanics of how an instruction becomes a trade — queues, spreads, auctions, and latency. You do not need to build an exchange to learn quant trading, but you must know where simulation ends and real infrastructure begins.

Quant platform

  • Quant Buffet backtest lab
  • QuantConnect / LEAN (library code)
  • Python + pandas locally

Research layer: signals, backtests, and strategy articles.

ConceptPlain English
Bid–ask spreadGap between best buy and sell price — hidden cost when you trade.
SlippageFill price worse than expected; Quant Buffet models 2 bps per side.
LatencyDelay from signal to fill; matters for HFT, less for monthly ETF rotation.
Partial fillOrder only partly executed — engine scales buys if cash is insufficient.

Research stack vs live stack

LayerBacktest labLive trading
Signal timeDaily closeIntraday or daily — your choice
Execution priceClose + 2 bps slippageBid/ask at your broker, plus impact
Commission5 bps per fill notionalBroker schedule, often far less for ETFs
CapitalVirtual $100,000Real cash, margin, and settlement rules
FillsAlways completePartial, rejected, or delayed
Failure modePython exceptionOutage, bad data feed, fat finger

Spreads: the cost you never see on a chart

InstrumentTypical spreadRound-trip cost
SPYabout 1 cent on ~$500≈ 0.2 bps
QQQ, IWM1–2 cents≈ 0.2–0.5 bps
EEM, TLT1–3 cents≈ 0.5–2 bps
Thin sector or country ETFs5–20 cents≈ 10–40 bps
BTC-USD at a retail exchangeSpread plus 10–50 bps feeCan exceed 100 bps

Spread cost scales with how often you trade, which is why Lesson 5 spends so much time on turnover. A strategy rebalancing monthly can absorb a 20 bps round trip; the same strategy rebalancing daily cannot.

Real failures worth memorising

EventWhat happenedWhat it teaches
Flash Crash, 6 May 2010The Dow fell about 1,000 points intraday and recovered within minutes. Accenture printed at $0.01; Sotheby's printed near $100,000.Market and stop-market orders can fill at absurd prices when liquidity vanishes.
Knight Capital, 1 Aug 2012A bad deployment sent unintended orders for ~45 minutes and cost roughly $440M — more than the firm's value.Deployment process is a risk control. Test the plumbing, not just the signal.
ETF dislocation, 24 Aug 2015Hundreds of ETFs traded far below their fair value amid halts at the open."The ETF price" is not guaranteed to equal the value of its holdings.
Volmageddon, 5 Feb 2018Short-volatility products collapsed; XIV was terminated and SVXY fell roughly 90%.Some instruments carry a risk that never appears in a calm sample.
Broker outages, March 2020Several retail platforms went down during the fastest crash on record.Your strategy is only as available as your infrastructure.

None of these are exotic tail stories you can ignore. Each one describes a specific way that a strategy which worked in a backtest lost money in reality — and each has a boring mitigation: limit orders instead of market orders, staged deployments, sanity checks on quoted prices, avoiding instruments whose worst case is undefined, and a documented manual fallback.

Rules that constrain real accounts

  • Settlement — US equities and ETFs settle T+1 (since May 2024). Selling and immediately redeploying can create good-faith violations in a cash account.
  • Pattern day trader — in a US margin account, 4 or more day trades in 5 business days requires maintaining $25,000 equity.
  • Wash sales — a loss is disallowed if you rebuy the same security within 30 days, which quietly penalises high-turnover rebalancing in a taxable account.
  • Short selling — needs a locate, pays borrow fees, and can be recalled. This is one reason the lab is long-only.
  • Crypto — trades 24/7 with no circuit breakers, so gaps happen while you sleep.

Capacity: the question that scales

A $100,000 account trading SPY is invisible to the market — your order is a rounding error against tens of billions of daily turnover. The same strategy running $500M in a thin country ETF would move the price against itself on every rebalance. This is why institutional research reports capacity alongside Sharpe, and why a strategy being "too small to matter" is a genuine advantage for a retail quant.

Before Lesson 5 — you should be able to

  • Contrast the lab's cost model with a real broker's schedule.
  • Estimate spread cost for liquid versus thin ETFs.
  • Name two historical events that punished market orders or bad deployments.
  • Explain T+1, the PDT rule, and wash sales in one sentence each.