Lesson 4 · 22 min
Microstructure & trading infrastructure
Exchanges, brokers, spreads, and how research simulation differs from live trading.
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.
| Concept | Plain English |
|---|---|
| Bid–ask spread | Gap between best buy and sell price — hidden cost when you trade. |
| Slippage | Fill price worse than expected; Quant Buffet models 2 bps per side. |
| Latency | Delay from signal to fill; matters for HFT, less for monthly ETF rotation. |
| Partial fill | Order only partly executed — engine scales buys if cash is insufficient. |
Research stack vs live stack
| Layer | Backtest lab | Live trading |
|---|---|---|
| Signal time | Daily close | Intraday or daily — your choice |
| Execution price | Close + 2 bps slippage | Bid/ask at your broker, plus impact |
| Commission | 5 bps per fill notional | Broker schedule, often far less for ETFs |
| Capital | Virtual $100,000 | Real cash, margin, and settlement rules |
| Fills | Always complete | Partial, rejected, or delayed |
| Failure mode | Python exception | Outage, bad data feed, fat finger |
Spreads: the cost you never see on a chart
| Instrument | Typical spread | Round-trip cost |
|---|---|---|
SPY | about 1 cent on ~$500 | ≈ 0.2 bps |
QQQ, IWM | 1–2 cents | ≈ 0.2–0.5 bps |
EEM, TLT | 1–3 cents | ≈ 0.5–2 bps |
| Thin sector or country ETFs | 5–20 cents | ≈ 10–40 bps |
BTC-USD at a retail exchange | Spread plus 10–50 bps fee | Can 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
| Event | What happened | What it teaches |
|---|---|---|
| Flash Crash, 6 May 2010 | The 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 2012 | A 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 2015 | Hundreds 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 2018 | Short-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 2020 | Several 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.