fivenines
13/39
Lesson 1.10

Post-trade: clearing and settlement

What you'll learn

What happens after the match: netting, settlement, and reconciliation — the machinery that makes a fill report into actual ownership.

Building on

Job 4 from lesson 0.1, fed by the fact stream from 1.1. Everything here is an asynchronous consumer of the journal (1.7).

A fill report says "Alice bought 100 ACME from Bob at 10.00." Post-trade turns that sentence into moved assets, in three stages:

flowchart LR
    TF["Trade feed from the core — every fill, all day"] --> CAP["1 · CAPTURE: enrich, assign trade IDs, confirm to both parties"]
    CAP --> NET["2 · NETTING: collapse each member's trades to one obligation per instrument"]
    NET --> STL["3 · SETTLEMENT at T+1: delivery versus payment — shares and cash swap atomically"]
    STL --> LED[("Custody ledger — the record of who owns what")]
    LED -.-> REC["Reconciliation: ledger vs journal replay — must match to the cent"]
    
The post-trade pipeline. It consumes facts, so it can run minutes behind, crash, and replay without ever touching trading availability — the payoff of the 1.1 tier split.

Netting is the volume crusher. A market maker might trade ACME 40,000 times today — buys and sells interleaved — yet net to: deliver 1,200 shares, receive 12,000 in cash. Settlement systems move the net, turning tens of millions of trades into thousands of transfers. (Real-world equities interpose a clearing house that becomes buyer to every seller and seller to every buyer — novation — so a defaulting member is the clearing house's problem, backed by margin, not their counterparties'. Our in-house version keeps the same shape.)

Settlement is delivery versus payment (DvP): shares and cash move in one atomic operation or neither moves. No state exists where Bob has given up shares but lacks his money. Within our own custody ledger this is a database transaction; against external banks and depositories it becomes coordinated batches with explicit failure handling.

Reconciliation is the immune system. Continuously, and fully at day's end: replay the journal, recompute what every account should hold, and diff against the ledger. Any nonzero diff pages a human. Position integrity beats availability — a market that is up but paying the wrong people is worse than one that is briefly down.

Key ideas
  • Capture → net → settle (DvP) → reconcile.
  • Netting collapses millions of trades into thousands of transfers.
  • Reconciliation against journal replay is non-negotiable; integrity outranks availability.
Next step

See what actually stuck.

Take the practice scenarios now.