A working engineer's course
The Plumbing of Money,
Everything in plain language, every concept with a diagram or runnable code, and every module ending in something you built.
Start with The invisible machine →
Module 0 · Orientation
- The invisible machine
Financial plumbing is the shared machinery that moves, settles and records money, and it stays invisible precisely because it works; this lesson orients you in the module and the course.
- Money as a record
Money began as a record of who owes whom, not as a thing; the tally stick is a split, tamper-evident ledger entry, and every later form of money refines that record.
- Goldsmiths and paper promises
When goldsmiths' paper receipts began circulating in place of vaulted gold, a warehouse ledger became bank money; a deposit today is still a bank's IOU in exactly that sense.
- The clearing house
When many banks owe each other daily, meeting once at a clearing house and settling only the differences replaces a spaghetti of pairwise payments with a handful of net ones; this is the idea the course later calls netting.
- From telegraph to Fedwire
In 1918 the Federal Reserve leased its own telegraph network to move reserves as Morse-coded messages; Fedwire's descendants still settle a wire one final, irrevocable entry at a time.
- The two-tier map
All money is an entry on somebody's ledger and the system has exactly two tiers: the central bank's ledger where banks settle in reserves, and commercial banks' ledgers where everyone else holds a bank's IOU; this map anchors every later module.
- The tokenisation claim
The tokenisation rebuild claims that message, settlement and asset can be fused into one object on a shared ledger; stablecoin issuers, commercial banks, central banks and asset managers all make versions of the claim, for different reasons, and the course treats each version as testable rather than settled.
- How to read this course
This course states claims you can run: directives give every perishable fact an expiry date, every asserted behaviour is demonstrated by an exercise or figure, results tables always carry a denominator, and the glossary keeps one name per concept.
- Install the toolkit
A fresh virtual environment with pinned numpy and matplotlib, verified by a script, is all the equipment the entire course needs; everything before this lesson ran on the standard library alone.
- Project: trace your first payment
Tracing one payment through a toy two-tier ledger, then moving the payee to a second bank so the payment must cross the central bank tier, proves you hold the map that the next seven modules fill in; this toy is the ancestor of module-01's miniledger.
Module 1 · Money at rest
- The ledger you will build
This module deepens the two-tier map into working machinery; by the end you will have built a small double-entry ledger library that later modules import.
- Money is a list, not a thing
Most money is not an object but an entry on a ledger; module 0 said it as a story, this lesson puts the record in code, and a payment becomes two edits to two lists.
- Double entry: every move has two legs
Double-entry bookkeeping records every movement as balanced debit and credit legs, turning 'the books balance' into an invariant a program can assert.
- A bank is a balance sheet
A bank is two lists under one invariant, assets on one side and liabilities plus equity on the other; your deposit sits on the liability side as the bank's IOU. Deposit insurance protects balances only up to a capped amount (an asof-dated figure); everything above the cap is an unsecured claim on the bank.
- The two tiers of money
Money differs by whose ledger it sits on: reserves are entries at the central bank that only banks can hold, while deposits are commercial-bank IOUs the rest of us use.
- Where physical cash fits
Physical cash is the one form of central-bank money the public can hold; a withdrawal swaps a bank IOU for a bearer instrument and shrinks both balance sheets.
- Settlement: when a payment becomes real
Settlement is the moment a payment's ledger edits become final; before it a payment is a promise in motion, after it a fact - the commit point of money.
- An interbank payment, leg by leg
When payer and payee bank at different banks, the deposit edits alone leave the banks out of square; they settle one tier up by moving reserves at the central bank.
- Loans create deposits
A bank loan writes a brand-new deposit into existence, expanding both sides of the bank's balance sheet; capital requirements and the drain of reserves to other banks are what limit it.
- The central bank's levers
The central bank steers toward its mandate, stable prices and full employment, with two levers: the rates at the edges of a corridor or floor set the price of money, and QE and QT set the quantity of reserves, all of it ordinary balance-sheet postings.
- Where money sleeps at night
Idle cash is parked in short-term instruments that trade safety against speed back to cash; T-bills sit in the best corner and set the benchmark everything else is measured against.
- Repo: a loan dressed as a sale
A repo is a secured overnight loan disguised as a sale and buy-back; the price gap is the interest and the bond is collateral the lender keeps if the borrower fails.
- Credit risk in the cash pile
Commercial paper and large bank deposits carry credit risk the T-bill does not - above the insurance cap they are unsecured claims - and a money market fund is a product that spreads the parking across all of them; the USDC weekend of March 2023 (a low of roughly $0.87-0.88, depending on venue) showed why it matters.
- The treasury desk
Every bank and large company runs a treasury desk that decides where the cash sleeps, trading off safety, liquidity and yield; stablecoin issuers run the same desk under a new name.
- Project: miniledger v1
Assemble everything built so far into miniledger v1, a small importable double-entry two-tier ledger whose invariants hold while an interbank payment settles in reserves.
Module 2 · Domestic rails
- The rails map and your workbench
A country moves money on a handful of rails, each a different trade between speed, cost and size; this module rebuilds every one of them on your miniledger.
- Clearing versus settlement
Clearing is agreeing who owes what; settlement is the ledger commit that makes it final; every rail is a different answer to when each happens.
- RTGS: the heavy-duty rail
RTGS settles each payment one by one, instantly and irrevocably, in central-bank reserves; it moves trillions a day in a tiny number of transfers.
- Intraday liquidity: what immediacy costs
Gross settlement means each payment needs its full value in reserves at the moment it settles, so timing and ordering, not daily totals, set the liquidity bill.
- Queues and the liquidity-delay trade-off
Post less liquidity and payments queue; the delay you accept and the reserves you park trade off along a measurable frontier.
- Gridlock and liquidity-saving mechanisms
A queue can deadlock in a cycle where every bank waits to be paid before paying; offsetting the cycle settles it simultaneously with almost no liquidity.
- Batch rails: deferred net settlement
Batch rails collect payments all day, cancel offsetting flows, and settle only the differences over RTGS at fixed cutoffs; netting is what makes everyday payments cheap.
- Inside the batch day: cutoffs, returns and reversals
A batch payment is a file entry that can still bounce days later; on deferred rails, arrived is not the same as final.
- Instant rails: settled in seconds, always on
Instant rails settle small payments with finality in seconds, around the clock, by pre-positioning liquidity before the payment ever arrives.
- The instant scoreboard
Instant payments are live on every major currency's home turf, but adoption runs from Pix and UPI carrying whole economies to FedNow's gradual build-out; all of them stop at the border.
- Card networks: the four-party model
A card payment is an authorisation in seconds and a settlement days later, coordinated among issuer, acquirer, network and merchant; cards are a deferred-net rail wearing a real-time costume.
- Interchange and card economics
Interchange flows from the merchant's bank to the cardholder's bank on every sale, funding rewards and fraud losses; capping it is the main lever regulators pull.
- Disputes and chargebacks
A chargeback is a rules-based reversal that reassigns liability by adding compensating entries; nothing on the ledger is ever deleted.
- Wallets and account-to-account overlays
Wallets and pay-by-bank apps are overlays that ride the rails you have already built; the question to ask of any fintech is which rail settles this.
- ISO 20022: one language for every rail
ISO 20022 replaces fifty years of free-text payment messages with structured, machine-readable fields; structure is the precondition for machine-run payments. Richer fields also mean fewer false alarms in sanctions screening, which is where much cross-border delay hides.
- Project: the rails simulator
One synthetic payment set, three settlement engines, two measurements - liquidity used and delay accepted - plus a gridlock you cause and then cure.
Module 3 · Across borders
- Crossing the border
A cross-border payment is not one payment; it is a relay of ledger edits, a currency toll and a pile of parked money, and this module simulates all three.
- The message is not the money
SWIFT moves no money at all; it is secure email between banks, and the instruction and the value travel on entirely separate tracks.
- The correspondent relay
No bank has branches everywhere, so a payment hops through partner banks called correspondents, and each hop adds a fee, a delay and a fresh point of failure. One of those hops screens the payment against sanctions lists (AML, anti-money-laundering checks, defined here at first use), and a compliance hold can dwarf every other delay.
- Nostro and vostro, one account with two names
The account your bank holds at a foreign correspondent is a nostro on your books and a vostro on theirs; one account, two perspectives, and it must mirror exactly.
- Pre-funding and the nostro float
To pay yen in Tokyo tomorrow the nostro must hold yen today, and the idle pre-funded balances across every corridor on Earth add up to trillions doing nothing.
- Building the correspondent-chain simulator
Wire hops, fees, cutoff times and time zones into one simulator on linked miniledgers, and days-not-seconds stops being a slogan and becomes an output you can read.
- The mid-market rate and the FX spread
A bank never converts at the rate on the news; it buys low from you and sells high to you, and the gap between those two prices is a toll collected silently inside the exchange rate.
- Basis points, the unit of tolls
One basis point is one hundredth of one percent, a unit that exists because on large payments hundredths of a percent are real money, and the toll scales with the notional.
- The remittance cost stack
A remittance pays fixed fees, per-hop fees and an FX spread all at once, and because the fixed parts do not shrink with the payment, small payments pay brutally more in percentage terms.
- Herstatt, the danger of paying first
A currency trade has two halves, and if you deliver yours before the other side fails to deliver theirs your loss is total; this settlement risk is named after a bank that died mid-trade in 1974.
- The versus family, both or neither
PvP, DvP, DvD and FoP name the ways two legs of an exchange can be bound together, and the safe ones all make the same promise: both legs happen at the same instant or neither does.
- CLS, payment versus payment at scale
CLS is the industry's manufactured both-or-neither: a specialist settlement system that settles both currency legs simultaneously for its member banks and covered currencies.
- Bilateral netting, settle the difference
Two banks with a thousand trades between them do not move money a thousand times; they add up who owes whom and move only the difference, like compacting a log into its final state.
- Multilateral netting and the hub
Put a hub in the middle and each bank makes one net payment against its whole trading day; cash in motion collapses by an order of magnitude, but every obligation now runs through one central point.
- Gross versus net: cash moved versus risk concentrated
Gross settlement is instant and hub-free but every trade must be fully funded; netting moves a fraction of the cash but concentrates risk in the hub and makes everyone wait, and neither is simply better.
- Project: the border crossing
Assemble the correspondent-chain simulator and the multilateral netting engine, break an FX settlement the Herstatt way, repair it with PvP, and price a remittance corridor end to end.
Module 4 · Markets and the cast
- The two doors: equity and debt
Every instrument in finance is a variation on two ideas - sell a slice of yourself or borrow with a promise - and seniority decides who is paid on the worst day.
- Equities: owning a slice and what it pays you
A share is a claim on a company's future profits, and the vocabulary around it - market cap, EPS, P/E, dilution - is arithmetic on that claim.
- Where shares actually live: the custody chain
Your share is not in your app; it sits at a central securities depository under a nominee name, with your ownership recorded as a chain of claims - the two-tier money pattern again.
- Corporate actions: when things happen to your shares
Dividends, splits and mergers are events that must propagate correctly down every layer of the custody chain, which is why a quiet, error-prone industry exists to process them.
- Bonds: the anatomy of a loan you can trade
A bond is an IOU you can buy, hold and sell, fully defined by five numbers, and its cash flows are just an array you can generate.
- A dollar later: present value
A dollar later is worth less than a dollar now because the dollar now could be earning interest; present value makes that discount computable, and it is the machinery joining price and yield in everything that follows.
- Price and yield: the seesaw, made computable
Price and yield are two views of the same bond joined by the present value machinery from the last lesson, which is why prices fall when rates rise; the conversion in each direction is a solver you can write.
- Duration: the price's sensitivity to rates
Duration is the derivative of price with respect to yield - a one-column Jacobian for a bond - and it tells you how hard a rate move hits before you ever reprice.
- The yield curve: expectations drawn as a line
The yield curve plots yield against maturity, its shape is a readout of where the market thinks rates are going, and the credit spread is the extra yield charged for default risk.
- Primary issuance: how securities are born
New securities enter the world through the primary market - bookbuilt IPOs for equity, single-price auctions for government debt - and the stop-out yield and bid-to-cover ratio tell you how the sale went.
- The order book: how a price forms
A price is not looked up, it is formed: an order book queues limit orders by price then time, matches market orders against the queue, and the best bid and ask are the market.
- Market makers: paid to stand in the middle
The bid-ask spread is a market maker's pay for holding inventory risk and for being picked off by better-informed traders; quote it too tight and adverse selection eats you.
- Asset managers: stewards of other people's capital
Asset managers invest pooled capital for a fee on assets under management, and at trillion-dollar scale even a few basis points is an enormous business; AUM figures here are asof-dated.
- Hedge funds: the leveraged specialists
Hedge funds are private pools running specialist strategies whose thin edges only pay through leverage; that leverage is why one fund's failure can become everyone's problem.
- Prime brokers: the infrastructure behind the funds
Prime brokers sell hedge funds the machinery of leverage - securities lending, margin financing, custody and clearing - and become their biggest creditors in the process, which is why they watch client risk in real time. The margin call named last lesson is computed here; module 5 gives it its formal machinery.
- Neobrokers and crypto desks: who pays for free trading
Zero-commission brokers sell retail orders to market makers instead of charging fees, and crypto-native desks are the same cast rebuilt on new venues; the cost of free hides in the price you get, and this landscape is asof-dated.
- Project: run a market
Everything in the module assembles into one running market: an engine that matches orders by price and time, a pricer that converts price and yield and reports duration, and a miniledger trace that proves who owns the share you just bought. The trade settles on a lag (T+1 in the US, asof-dated), and the day of counterparty risk that lag creates is the window module 5's clearing machinery exists to close.
Module 5 · Leverage, collateral, clearing
- The amplifier and the safety net
This module is one story told twice: leverage multiplies exposure, and collateral, margin and clearing houses are the machinery that keeps the multiplication from cascading when someone fails.
- Futures and forwards: a binding contract about a price
A future obliges both sides to trade at a set price on a set date, so its payoff is linear in the settlement price; a forward is the same promise made privately instead of on an exchange.
- Margin and leverage: the amplifier
Posting a fraction of a position's value multiplies every percentage move by the leverage factor, and liquidation is the exchange force-closing you before losses exceed the deposit. You met a margin call at the prime broker in module 4; this lesson gives it its formal machinery.
- Perpetual futures: replacing expiry with a feedback loop
A perp is a future that never expires, so a periodic funding payment between longs and shorts, sized by the gap between mark and index, does the tethering that expiry used to do; a reconciliation loop in place of a deadline.
- Calls and puts: the right, not the obligation
An option buyer pays a premium for the right to trade at the strike and can lose at most that premium; the writer keeps the premium and carries an obligation with no such cap.
- Moneyness and a toy pricer: what a premium buys
A premium splits into intrinsic value, which you could exercise for today, and time value, the priced chance of ending up in the money; a small binomial tree computes both by working backwards from expiry. The tree's step size comes from a volatility input, the knob the next lesson names.
- The Greeks: an option's dashboard
Delta, gamma, theta and vega are finite differences on the pricer: nudge one input, reprice, and read off how the position will behave before the market moves. Implied volatility is the pricer's volatility input run backwards - the volatility the market's own price implies - and IV crush is what happens when it collapses under you.
- Option strategies: composing payoffs
Covered calls, protective puts, straddles and iron condors are sums of the four basic payoffs, so building a strategy is composing payoff functions the way middleware composes handlers.
- Amortisation: how a loan pays itself off
A level payment stays constant while its mix flips from mostly interest to mostly principal, because interest is charged on a balance that every payment shrinks.
- Asset servicing and the payment waterfall
A servicer splits every collected payment down a strict priority order of fees, interest and principal, which is precisely the kind of rule a program can run without a back office.
- Securitisation: tranching a pool of loans
An SPV issues securities against pooled loan cash flows that pay top down and absorb losses bottom up, which is how a safe senior tranche is built from loans that are not safe; 2008 is what happens when the inputs are wrong.
- Initial and variation margin: collateral in motion
Initial margin is a buffer posted up front against possible losses and variation margin settles the actual profit or loss daily; a margin call is the demand that specific collateral arrive at a specific time.
- Rehypothecation: your collateral is being reused
A rehypothecation clause lets a broker re-pledge your collateral, so one T-bill can back three or four obligations along a chain; leverage that appears on no single balance sheet until a default unwinds it.
- Central counterparties: the clearing house
Novation puts a CCP between every buyer and seller, replacing a web of bilateral exposures with one hub protected by a strict loss-absorbing stack; counterparty risk is not removed, it is concentrated and capitalised.
- Project: the margin engine
Everything in one build: IM and VM on a futures book, a funding loop pulling a perp's mark to its index, a Greeks dashboard computed from your own pricer, and a CCP that nets the book and survives a member default.
Module 6 · Tokenised money and assets
- From two tiers to one ledger
A blockchain, for this course's purposes, is one shared append-only ledger with no tiers and no single bookkeeper, so moving a token is a single balance update rather than a relay of promises.
- The tokenised dollar
A stablecoin is a token whose issuer promises one unit of ordinary money per token, with a real dollar of reserve assets behind each one; sending it fuses the message and the settlement into a single step.
- SPVs and licences: the legal cage
The reserve assets sit in a bankruptcy-remote entity and the issuer operates under licence, with one-to-one backing and redemption at par the common thread across regimes; the cage decides whether a holder owns segregated assets or joins a creditor queue.
- The reserve yield model
The issuer holds customer money at zero interest, parks it in bills and repo, and keeps the yield; paying holders would reclassify the token as an investment product, so free transfers are subsidised by interest forgone.
- Reading a reserve attestation
An attestation is a snapshot rather than an audit, and reading composition, custodian and timing tells you how much of the reserve portfolio turns into cash on a bad day, which is the number the peg actually depends on.
- Mint and burn
Only vetted institutions deal with the issuer directly: wiring dollars in creates tokens, returning tokens destroys them and sends dollars back, and both are paired postings that preserve the one-to-one invariant.
- Arbitrage and the peg
The peg is held by the arbitrage loop rather than by the reserve assets alone: backing makes redemption possible, while the speed and openness of the mint and redeem path is what pulls a drifting price back to one dollar.
- When the peg breaks
A perfectly backed token can still leave its peg when redemption slows, and impaired backing settles at what the reserve assets are actually worth; two failure shapes that look identical from the outside on the first day.
- The thirty-year-old machine
An ETF keeps its price honest through participants who create and redeem shares against the underlying basket, and the mint-and-burn machine is that same mechanism with a fixed one-dollar promise instead of a floating value, which turns tracking error into crisis.
- Tokenised deposits versus stablecoins
A tokenised deposit is commercial bank money in token form: it sits on one bank's balance sheet, carries that bank's credit and usually moves only inside that bank's network, which makes it a competing design rather than a variant.
- CBDC: the top tier in token form
A CBDC would be central bank money as a token; wholesale designs slot cleanly into interbank settlement while retail designs stall on bank disintermediation, privacy politics and unclear demand, which is why most projects never leave the pilot stage.
- The token is a wrapper
Tokenising changes how an asset transfers and settles, never what it is or what it is worth; the hard parts are custody, legal claim and servicing, the links that keep the token telling the truth about the world.
- Putting credit on-chain
Tokenised credit runs a spectrum from receipt tokens with off-chain servicing to payment waterfalls executed in code, and the problems that remain are human ones: pricing illiquid loans, suing defaulters, and borrowers who still pay by bank transfer.
- What actually gets tokenised
Tokenised Treasuries lead because the underlying is liquid, safe and easy to price; the round-the-clock wrapper still floats on an underlying market that closes at the weekend, and the gap shows up at Monday's open.
- Tokenised securities
A natively issued security collapses much of the post-trade chain, with ownership in the contract and settlement atomic, while registration, transfer restrictions and the ramps at either end survive unchanged.
- Tokenised asset versus MMF
What an instrument is and what form it takes are different questions; a tokenised money fund floats with its portfolio, and confusing it with a stablecoin means confusing the promise with the wrapper.
- Project: a stablecoin under stress
The module's machine assembled and stressed: a full issuer whose peg holds, dips or settles short depending on what its reserve assets are and how fast redemption runs.
Module 7 · Token markets and the frontier
- Two ledgers on the bench
Tokenised money and assets now need markets, and this module's endgame needs two ledgers that cannot see each other, so both go on the bench before anything else is built.
- AMMs: trading against a formula
An automated market maker replaces the human market maker with a pooled pair and an invariant, so the price is a formula over two balances and your own trade moves it against you.
- Fees, impermanent loss, and what providers earn
A liquidity provider's return is fee income minus impermanent loss, and only the yield that survives with no token emissions is real.
- Concentrated liquidity
Concentrating liquidity inside a chosen price range multiplies its effectiveness at the cost of active management, and a position whose price leaves the range stops earning entirely.
- Order books and RFQ: the quote-based family
An on-chain order book pays a state change for every order, so institutional size trades through request-for-quote engines with vetted counterparties instead of against a formula.
- Dark pools and block trading
For institutional size the dominant cost is market impact, so venues run a spectrum from fully lit order books through quote auctions to pools that hide orders until after execution.
- Mid-flight FX conversion
In a tokenised payment the currency conversion can execute inside the same transaction that delivers the money, folding module 3's separate FX hop into the payment itself.
- Rebuilding the exchange: order book or vault
A derivatives venue must solve liquidity, price, margin and capital efficiency at once, and the two architectures split on who takes the other side of your trade.
- The mark price: a number an attacker cannot shove
A liquidation trigger needs a price nobody can move on purpose, so venues liquidate on a smoothed mark blended from an index and local trading rather than on the last print.
- The liquidation engine
Somebody must force-close leveraged positions before losses exceed posted margin, and on-chain that somebody is an engine built from a maintenance level, an insurance fund and auto-deleveraging as the last resort.
- Isolated, cross and portfolio margin
Margin regimes trade blast containment for capital efficiency, and portfolio margin's large savings rest on correlation assumptions that fail exactly when markets do.
- Bridges: the first fix and its scars
Lock-and-mint bridges copy an asset instead of settling it, which creates a custodian worth robbing; the sums lost taught the field to swap or settle rather than copy.
- Atomic DvP across incompatible ledgers
Two conditional locks and one shared secret give a cash-for-asset trade the both-or-neither guarantee across sovereign ledgers, with no bridge, no copied asset and no custodian in the middle.
- From token swaps to an FX clearing rail
Stack quote-based pricing, vetted counterparties and atomic settlement and you have built a clearing rail; netting then makes the same jump across ledgers that module 3 made within one.
- Collateral that moves at the speed of a message
Tokenised collateral turns pledging into a ledger transfer, unlocking intraday repo and cross-ledger collateral swaps, and it accelerates contagion by exactly as much as it accelerates the rescue.
- The treasury desk becomes software
Always-on atomic rails turn a treasury desk's daily decisions into rules an agent can execute, provided the agent is caged by spending limits, allowlists and a kill switch enforced in code.
- Who buys the new plumbing, and for what
Different buyers purchase the same primitives for different pains, and the strategy reduces to a few pillars plus the unresolved question of who operates a rail nobody owns.
- The honest scorecard
Tokenisation reliably changes settlement speed, atomicity, reconciliation and composability while changing nothing about the asset, its risk or the FX problem, so value concentrates where the first list dominates.
- Project: trade, liquidate and settle across two ledgers
The module assembled into three artefacts: a pool whose impermanent loss is measured against holding, a liquidation engine driven through a gapping crash, and delivery versus payment across two ledgers proven both-or-neither under failure at every step.