FSingle films

Markets

Film 13 of 13

Building a Top-Tier Real-Time Trading System

50 min of film16 chapters

A 16-chapter explainer, in five parts, of how a top-tier electronic market maker (the kind of system Jane Street, Hudson River Trading and their peers run) is built: the game (what a market maker earns, why spreads exist, what an exchange is), seeing the market (the exchange feed byte by byte, rebuilding the order book), the race (why microseconds matter, the speed of light between Chicago and New Jersey, the latency ladder inside a server, kernel bypass, pinned cores and ring buffers, FPGAs), the brain (fair value from order-book imbalance, Avellaneda–Stoikov quoting, backtesting against real queues) and staying alive (pre-trade risk checks and Knight Capital, determinism and replay, clocks, the research loop).

Neither firm publishes its blueprints. The video assembles the public record (engineers' talks and blog posts, exchange specifications, regulatory filings, academic studies) and checks it against two kinds of measurement:

  • One real day of exchange data, every message. Nasdaq's full TotalView-ITCH 5.0 feed for Wednesday, December 10, 2025, the day of a Federal Reserve rate decision: 846,781,990 messages, 27.0 GB, 12,114 symbols, scanned in one pass by native/itch_scan.c. Every chart of market data, every order book, every queue, and the market-making backtest come from it.
  • Experiments on the computer that rendered the video (native/bench.c, native/book.c): the memory-latency staircase with and without huge pages, system calls, core-to-core hand-offs, kernel UDP, a lock-free ring buffer, false sharing, branch prediction, OS jitter on a pinned core, and an order book processing the whole day of SPY.

Schematics are labeled schematic. Numbers the narration states are asserted against the data at render time.

An explanation of public information, not affiliated with any firm named, and not investment advice.

Contents

  1. 1Two o'clock on Fed day3 min
  2. 2Part 1: What a market maker does4 min
  3. 3Inside the exchange4 min
  4. 4Part 2: The feed, byte by byte3 min
  5. 5Rebuilding the order book3 min
  6. 6Part 3: Why microseconds matter3 min
  7. 7The speed of light3 min
  8. 8Inside the box: the latency ladder3 min
  9. 9The hot path in software4 min
  10. 10Hardware: deciding before the packet ends3 min
  11. 11Part 4: Fair value3 min
  12. 12Quoting: spread, skew, inventory3 min
  13. 13Testing on real queues4 min
  14. 14Part 5: Risk, and Knight Capital3 min
  15. 15Determinism and the research loop3 min
  16. 16The whole machine2 min

Also on this page: Lecture · Notes and sources · Build the film.

Lecture

The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film. A dashed box stands for a number the film computes when it is rendered (hover over it to see what is computed); the README's figures for each chapter, where it lists them, follow the chapter's text.

1Two o'clock on Fed day3 min

December 10th, 2025, a few seconds before two o'clock in the afternoon. In a data center in Carteret, New Jersey, Nasdaq's computers are processing a stream of messages from traders: orders to buy, orders to sell, changes, cancellations. At exactly two o'clock, the Federal Reserve will announce its decision on interest rates, and the machines know it. In the last second, they start pulling their orders out of the book. Half a second before two: sixteen thousand cancellations in a tenth of a second, across more than fourteen hundred stocks. Nobody wants to be standing in the book when the news lands.

Two o'clock. A quarter-point cut. Within a second the machines are back, quoting and trading furiously: thousand messages in the next three seconds. Nearly every one was generated by a computer, most of them within microseconds of the computer seeing something change.

Zoom out to the whole day. The opening bell at 9:30: more than seven hundred thousand messages in a single second. The Fed at two. And the busiest second of the regular session came forty minutes later, during the Fed chair's press conference: 933 thousand messages in one second. The close at four is busier still. In total, Nasdaq's feed carried 846.8 million messages that day, 27 gigabytes, from one exchange among more than a dozen in the United States.

The firms that thrive in this torrent are among the most profitable businesses in the world. Jane Street trades on more than two hundred venues in forty-five countries, and reportedly made 39.6 billion dollars of trading revenue in 2025. Hudson River Trading says it trades on nearly all the world's electronic markets. And there are others. None of them publishes a blueprint. But between their engineers' public talks and blog posts, exchange specifications, regulatory filings, a full day of real exchange data, and some experiments on this very computer, we can rebuild the machine they all converge on, piece by piece, and measure every piece.

Here is that machine, as a loop. The exchange broadcasts every change to its order book. A feed handler decodes the messages, and rebuilds the book. The strategy estimates what the stock is really worth, decides where to buy and sell, passes every order through risk checks, and sends it back to the exchange. The time for one trip around this loop is called tick-to-trade, and at the top firms, it's measured in nanoseconds. We'll build it in five parts.

What it establishes: Nasdaq in the seconds around the Fed's 2:00 pm decision: firms pull quotes, then flood back. The day's shape. The firms. The trading loop, tick to trade.; Real data on screen: Messages per 0.1 s by type, 13:59:58–14:00:03 (16,157 deletes in the 100 ms at 13:59:59.5, across 1,431 stocks); busiest second in every 10 s, 9:00–4:30; 846.8 M messages, 27.0 GB.

2Part 1: What a market maker does4 min

This is what the market looks like to a trading machine. It's Nasdaq's order book for Nvidia, at 10:30 that morning, rebuilt from the exchange's own data feed. Every block is one real order. Its width grows with the number of shares. Below the middle are bids: orders waiting to buy. Above are asks: orders waiting to sell. At each price the orders wait in a queue, and the queue is served first come, first served.

The best bid is 183.85 dollars, the best ask 183.86. The gap between them is the spread: one cent. Halfway between is the mid-price. Over the whole day Nvidia's spread on Nasdaq averaged 1.1 cents, on a 183-dollar stock. That's about six thousandths of a percent.

A market maker's job is to always stand on both sides: willing to buy at the bid and to sell at the ask. Its orders join the back of the queues, like everyone else's. When a seller arrives, the bid queue is filled from the front, until it reaches us: we buy 100 shares at 183.85. Later a buyer arrives and works through the ask queue: we sell 100 shares at 183.86. Bought at 85, sold at 86. One cent per share, a dollar in total, for providing liquidity: for being there when someone wanted to trade.

If every trader were like those two, market making would be easy money. It isn't, because some of the people trading with you know something you don't. Most of the flow is uninformed: people buying and selling for their own reasons, at random as far as the price is concerned. Against them, the market maker earns half the spread on every trade. But now and then, someone buys from you just before the price jumps, because they saw it coming, perhaps because their information arrived a few microseconds before yours. That one trade costs three and a half cents a share, seven times what an uninformed trade earns.

In 1985, Lawrence Glosten and Paul Milgrom turned this into a theory of why spreads exist at all. If a fraction pi of the traders are informed, and they move the price by delta, the market maker breaks even only if what it earns from the many pays for what it loses to the few: half the spread must equal pi times delta. If one trader in eight knows the price is about to move four cents, the half-spread has to be half a cent. The spread is an insurance premium against being picked off.

So the market maker's edge is a fraction of a cent per share, and it lives or dies on two abilities. Be right: know where the price is going, so the spread you charge covers the risk. And be fast: update your quotes before someone with fresher information can trade against them. With an edge that thin, the business only works at enormous volume, which means a machine making millions of decisions a day, each one right, and each one fast.

What it establishes: The order book, queue by queue. The spread. Two-sided quoting earns the spread; informed traders cost more than uninformed ones pay (adverse selection); Glosten–Milgrom: s/2 = πΔ. Be right and be fast.; Real data on screen: NVDA's book at 10:30:00.000, every order; the day's time-weighted spread, 1.108 ¢. Price path is schematic.

3Inside the exchange4 min

Now the other side of every trade: the exchange. An exchange is at heart a machine for one job: deciding the order in which things happened. Thousands of connections from trading firms arrive through gateway machines, and every message from all of them is funneled into a single line, where a sequencer stamps it with the next number. Then a matching engine processes the messages one at a time, in exactly that order, on a single thread. One line, one thread: no locks, no ambiguity about who came first.

The matching rule is called price-time priority. An incoming order to buy trades first against the cheapest offers, and among offers at the same price, against whichever arrived first. Whatever can't be filled rests in the book, at the back of the queue at its price: here it becomes the new best bid.

Because the engine handles one event at a time, a single order can produce a flood. At 10:38 that morning, one order in Netflix traded against 4,076 resting orders at once. The feed reported it as 4,108 messages, every one stamped with the same nanosecond. To the matching engine it was one event.

Then the engine has to tell everyone what happened, and fairly: everyone should learn it at the same time. The obvious way is a separate connection to each subscriber, but then the messages leave one after another. At ten gigabits per second, a thousand-byte message takes about a microsecond to put on the wire, so the six-hundredth subscriber hears the news six hundred microseconds after the first. That's the example Jane Street's Brian Nigito gives.

So exchange data is sent with IP multicast: the engine sends each message once, and the network switches copy it in hardware to every subscriber at the same moment. It's unreliable, like all UDP, so every message carries a sequence number, and anyone who misses one asks a retransmission server to fill the gap.

So what is in that stream? Here are the 803 million messages of the regular session on Nasdaq that day, as a thousand squares. Over a third are new orders. More than a quarter are replacements: an order's price or size changed. A third are cancellations. And trades? Two percent, about what Nigito estimates for the U.S. market as a whole. Ninety-seven percent of all the orders placed that day never traded at all. Most of the activity of a modern market is quoting, and re-quoting, and getting out of the way.

That single numbered line buys something else: reliability. If every component is a deterministic function of the sequenced log, then a backup matching engine reading the same log computes exactly the same state as the primary, message for message, and so does the market data publisher, and the clearing reports. Lose any machine, and its replacement replays the log and catches up. It's called state machine replication. Jane Street built its own matching system, JX, this way: each component handles around half a million messages a second, with latencies of a few microseconds, and any one of them can be rebuilt from the log in under a minute. Remember this idea: the best trading systems are built the same way.

What it establishes: Gateways → one sequencer → one matching thread. Price-time priority. One Netflix order trading against 4,076 resting orders, stamped with one nanosecond. Unicast vs multicast (Nigito's 600 µs). The message mix. State machine replication (Jane Street's JX).; Real data on screen: NFLX at 10:38:37.273156756 (4,108 messages at one ns); regular-session mix: new 34.9%, replaced 27.5%, canceled 34.2%, executions 2.0%; 97.3% of orders never trade.

4Part 2: The feed, byte by byte3 min

Let's look at what actually arrives from the exchange. This is one real message from Nasdaq's data feed, exactly as it went out a millisecond after the opening bell that morning: thirty-six bytes. The format is called ITCH, and Nasdaq publishes its specification.

Byte by byte: the first byte is the letter A: this is an Add Order. Two bytes give the stock's index for the day. Six bytes are a timestamp: the number of nanoseconds since midnight, which works out to 9:30 and 1.3 milliseconds. Eight bytes are the order's reference number, one byte says buy or sell, four bytes the number of shares, eight the ticker, and four the price, in ten-thousandths of a dollar. Put together: someone wants to buy a hundred shares of Nvidia at 180 dollars and 35 cents, and from now on, that order will be known only by its number.

Other messages are even shorter. A delete is nineteen bytes, and says only: remove order number such-and-such. An execution names the order that traded, and how many shares. A replace swaps an old order for a new one with a new price or size. Notice what's missing. A delete doesn't say the price, the side, or even the stock. To know what it means, you have to remember every order you have ever seen, all day. That's what the order book is for.

Messages travel in UDP packets, a few at a time, behind a small header whose key field is a sequence number. Multicast is unreliable: packets can be lost. So exchanges send everything twice, over two separate networks, called the A and B feeds. The feed handler's first job is arbitration: for each sequence number, take whichever copy arrives first, and drop the duplicate. If a number is missing from both, there's a gap, and the book can't be trusted until it's filled from a retransmission server.

And the volume is relentless. On an ordinary stretch of that day, about 34 thousand messages a second. In the busiest second, just after the closing bell, 1.75 million. And bursts arrive all at once: that single Netflix event was about 136 kilobytes, which takes over a hundred microseconds just to cross a ten gigabit wire. A feed handler has to swallow all of it, in order, without falling behind, because the moment it falls behind, every decision it makes is based on a picture of the past.

What it establishes: A real Add Order, 36 bytes decoded field by field; Delete, Execute, Replace; MoldUDP64 packets, A/B arbitration, gaps. Volume and bursts.; Real data on screen: NVDA's first messages after the open (buy 100 @ 180.35, order #54,010,847, 09:30:00.001333600); 34,311 messages/s average, 1,752,575 in the busiest second; the Netflix burst ≈ 136 kB ≈ 108 µs on a 10 Gb/s wire.

5Rebuilding the order book3 min

So a feed handler must remember every live order. How you store them decides how fast you are, so here is the design almost everyone converges on. First, an array of price levels, indexed directly by the price in cents: finding a price is just arithmetic, no searching. Each level holds its orders as a first-in, first-out list: the front of the list is the front of the queue. Second, a hash table from each order's reference number to where that order lives, because cancels and executions name only the number.

Watch the real add order from before arrive. Hash its number to find a slot in the map. Take a pre-allocated order record, fill it in, and link it onto the back of the 180.35 list. Update the level's total, and if the price beats the best bid, move the best-bid marker. A handful of memory accesses, and no matter how many orders are in the book, it takes the same time.

A delete: hash the number, follow the pointer straight to the order, and unlink it: its neighbors now point at each other, and the record goes back on a free list for reuse. Nothing is searched, and nothing is allocated from the operating system while trading.

How fast is it? Here is every message of SPY, the most traded ETF in the world, for the whole day on Nasdaq: almost fifteen million of them, through two implementations of exactly this design. In Python, about 780 nanoseconds a message. In C, about 38. And touching all the memory in advance, so the operating system never has to stop the program to hand it a fresh page, removes pauses and brings it to 35. The whole day of SPY, rebuilt in about half a second.

But averages hide the thing that matters most. Timing every update individually, the typical one takes well under a hundred nanoseconds, and ninety-nine in a hundred finish within a few hundred. But one in ten thousand takes more than ten microseconds, a hundred times longer, and the code had nothing to do with it: something else, the operating system or the virtual machine underneath it, interrupted the program. Those rare stalls tend to arrive exactly when the market is busiest. We'll come back to them.

What it establishes: Price-level array + FIFO lists + hash map, animated for a real add and delete. Python vs C on the whole SPY day; pre-faulting memory; the per-update tail.; Real data on screen: 14,953,094 SPY messages: Python 777 ns/message, C 38 → 35 ns (6,819 page faults removed); per-update median 67 ns, 99.99th pct 14 µs. Both books agree at end of day.

6Part 3: Why microseconds matter3 min

Why does any of this have to be so fast? Here's the clearest example I know. SPY, IVV and VOO are three exchange-traded funds run by three different companies, and all three hold exactly the same thing: the 500 stocks of the S&P 500. Over the day, measured by their prices on Nasdaq, they move in perfect lockstep, as they must.

Now zoom in to a single second. They don't move together at all. Each fund's price jumps at its own moments, a few milliseconds apart. Information reaches each of them separately, through the separate decisions of the traders quoting them.

We can measure this. Take the price changes of two of these funds over intervals of a given length, and compute their correlation. Over a minute: 0.999, practically identical. Over a second: 0.96. Over ten milliseconds, a coin flip's worth: one half. Over one millisecond, almost nothing. Economists Eric Budish, Peter Cramton and John Shim found the same collapse in 2011 data, between S&P 500 futures in Chicago and SPY in New York.

That collapse is where the race lives. Suppose SPY ticks up. For a few microseconds, an offer to sell IVV at the old price is stale: too cheap. Somebody will try to buy it before it disappears. And the market maker who posted it will try to cancel it before that happens. Both see the same news; both send a message to the same matching engine. Whoever arrives first wins, and the one that loses, loses money.

How often does this happen? Using the London Stock Exchange's own message logs, which record the losers of each race as well as the winners, Matteo Aquilina, Eric Budish and Peter O'Neill found that a typical race lasts five to ten microseconds. There's about one a minute in every major stock, races account for a fifth of all trading, and six firms are on one side or the other of more than eighty percent of them. In global stock markets, about five billion dollars a year.

And you can see the race in Nasdaq's data. For every trade that day, in every stock, here is the time until the next order message in the same stock: a new order, a cancel, a change. Look at that spike, between twenty and twenty-five microseconds. That's the round trip of the fastest firms: Nasdaq publishes the trade, their machines receive it, decide, and send a response, and Nasdaq's own systems accept it and put it in line. Every reaction faster than that spike is a reaction to something other than this trade. The orders themselves are fleeting: percent of the orders canceled that day were canceled within a millisecond of being placed, and percent within a tenth of a second, faster than a blink.

What it establishes: SPY/IVV/VOO: lockstep over a day, independent within a second; correlation collapses at short horizons (Epps effect; Budish et al.). Stale quotes and latency-arbitrage races (Aquilina, Budish & O'Neill). The reaction spike. Fleeting orders.; Real data on screen: Mid-prices of the three ETFs on Nasdaq; SPY–IVV return correlation 0.999 (1 min), 0.96 (1 s), 0.50 (10 ms), 0.23 (1 ms), 0.04 (0.1 ms); 11.4 M gaps from a trade to the next order message: mode 20–25 µs; 14% of deleted orders deleted within 1 ms, 42% within 0.1 s.

7The speed of light3 min

Every race in this market is limited by one fact about the universe: information cannot travel faster than light. Here is the most valuable stretch of geography in American finance. In Aurora, Illinois, outside Chicago, sits the matching engine of the CME, where S&P 500 futures trade. And about seven hundred miles east, in New Jersey, sit the stock exchanges: Nasdaq in Carteret, the New York Stock Exchange in Mahwah, and many other venues around Secaucus.

When futures move in Chicago, every quote on a related stock or ETF in New Jersey is suddenly out of date, so there's a race to carry the news east. The shortest path along the Earth's surface is about 1,178 kilometers. Light in a vacuum covers that in 3.93 milliseconds. That's the floor. No network, no algorithm, no amount of money will ever beat it.

Light in optical fiber is slower. Glass has a refractive index of about 1.47, so even a perfectly straight fiber would take 5.77 milliseconds. And real fiber follows railways and highways. In 2010, a company called Spread Networks dug a new, straighter route through the Allegheny Mountains, 825 miles of cable, just to bring the round trip down to 13.33 milliseconds. Trading firms paid a fortune to lease it.

Then the industry did something that sounds backwards: it went back to radio. Microwaves travel through air at almost exactly the speed of light, so firms built chains of towers, each able to see the next, as close to the great circle as the landscape allows. By 2016, one network was delivering data from Aurora to Carteret in 3.982 milliseconds, just 53 microseconds, or 1.3 percent, slower than light in a vacuum.

Let's race them, slowed down about sixteen hundred times. The same news leaves Aurora at the same instant. The microwave signal arrives first. A perfectly straight fiber would arrive 1.8 milliseconds later, and a real fiber route later still. In a market where races are decided by microseconds, that is an eternity. Microwave links carry very little data, and heavy rain can knock them out, so firms keep fiber as a backup and send only the most valuable bits through the air.

The same logic plays out at the scale of meters. Exchanges rent space inside their own data centers, so trading servers can sit a few meters from the matching engine. That's called colocation. To keep it fair, exchanges give every colocated customer the same length of cable: one meter of fiber costs about five nanoseconds, so the customers closest to the exchange get extra fiber, coiled up. And yes, firms argue about this. In a 2024 letter to the SEC, a group of trading firms pressed Nasdaq to equalize latency across its whole Carteret campus, in a dispute where Nasdaq itself put one of the differences at 50 to 200 nanoseconds.

What it establishes: Aurora → Carteret: 1,178 km; light in vacuum 3.93 ms; straight fiber 5.77 ms; Spread Networks' 2010 route 13.33 ms round trip; microwave 3.982 ms (2016), 53 µs (1.3%) above the vacuum limit. The race, slowed down. Colocation and equal-length cables.; Real data on screen: Data-center coordinates from OpenStreetMap; outlines from Natural Earth. Tower positions and the fiber route's shape are schematic.

8Inside the box: the latency ladder3 min

Now let's go inside a single server, where the units shrink from milliseconds to nanoseconds. In one nanosecond, light travels thirty centimeters, about a foot. This machine's processor ticks every half nanosecond. Here's an experiment run on the computer that rendered this video: fetch memory from random addresses, each fetch depending on the last, and time each fetch as the amount of memory grows. While everything fits in the tiny first-level cache, a fetch takes about a nanosecond and a half. In the second-level cache, about five. In the big shared third level, fifty or more. And out in main memory, two to three hundred nanoseconds. Two hundred times slower than the fastest case, for the same line of code.

Part of that cost isn't the data at all. Programs use virtual addresses, and the processor must translate each one into a physical address, with the help of a small cache of translations called the TLB. As engineers at Hudson River Trading explain on their tech blog, a miss in that cache means walking a tree of page tables: at least three dependent memory reads, or two hundred and ten nanoseconds in their example, before you even fetch your data. Their fix: huge pages, which let one translation cover 512 times more memory. Same experiment, with huge pages. Out in main memory, reads get about thirty percent faster.

Put all the measurements on one ladder. A clock cycle, half a nanosecond. The three levels of cache. A system call, the cheapest possible request to the operating system: about a hundred nanoseconds. Handing a piece of memory from one core to another: about two hundred. Main memory: about three hundred. And sending one small message from one program to another through the operating system's network stack: almost three microseconds if the receiver is spinning, waiting for it, and fourteen if it's asleep and has to be woken up. To feel the proportions: if reading the first-level cache took one second, the sleeping receiver would take nearly three hours. Light gets from Chicago to New Jersey in four milliseconds, which on this scale is a month. And remember the market's reaction spike: twenty microseconds. Most of these rungs fit inside it many times over, but the bottom two eat a big piece.

What it establishes: The memory hierarchy measured: L1 ≈ 1.5 ns, L2 ≈ 5 ns, L3 ≈ 30–75 ns, DRAM ≈ 200–290 ns; the TLB (HRT's huge-pages post) and huge pages measured; the ladder of everything, at human scale.; Real data on screen: Pointer chasing 4 KiB–1 GiB, 4 KiB vs 2 MiB pages (1 GiB: 291 → 207 ns); syscall 102 ns; core-to-core 220 ns; kernel UDP 2.8 µs spinning / 14.2 µs asleep.

9The hot path in software4 min

That bottom rung, the operating system, is the first thing a trading system gets rid of. Normally, when a packet arrives, the network card interrupts the processor, the kernel's driver and network stack process it, it waits in a socket buffer, and only when your program asks, through a system call, is it copied to you. If your program was asleep, it also has to be woken up. On this machine, that path costs about fourteen microseconds when the receiver sleeps, and three when it spins. Trading firms use network cards that write packets straight into a ring of memory inside the program, which watches that memory constantly. The kernel never touches the data. Brian Nigito puts a frame's trip from the wire into a program at under a microsecond.

Inside the program, the same philosophy. Each job gets its own processor core: one decodes the feed, one runs the strategy, one sends orders. Each core is reserved, shielded from the operating system's other work, and never sleeps: it spins in a tight loop, checking for new work billions of times a second. The cores pass messages through ring buffers: a fixed circle of slots in shared memory. The producer writes into the next slot and advances its counter; the consumer reads behind it and advances its own. No locks, no system calls, and the memory is allocated once, at startup. Measured here: almost sixteen million messages a second, and a median hand-off of three hundred nanoseconds.

But sharing memory between cores has a trap. Processors move memory around in sixty-four-byte blocks called cache lines, and only one core can own a line for writing at a time. Put two counters side by side, give one to each core, and let both increment their own, millions of times. They share nothing, logically, but the line they live on bounces between the two cores on every write. On this machine, that's about forty-six nanoseconds per increment instead of six: eight times slower. It's called false sharing, and the fix is just padding: keep each core's hot data on its own line.

Another invisible cost: here's a loop that adds up the numbers above a threshold. On random data, it takes about three and three-quarter nanoseconds per number. On the same numbers, sorted, under half a nanosecond: eight times faster. The processor guesses which way each 'if' will go before it knows, and runs ahead. Sorted data makes the guess easy; random data makes it wrong half the time, and every wrong guess throws away work. So hot-path code is written to be predictable, and some firms even keep it warm, running fake decisions through it so the caches and predictors are ready when a real one comes.

And then there's the noise that isn't your code at all. Here a reserved core on this machine did nothing but check the clock as fast as it could for ten seconds, and recorded every gap: every moment something else took the processor away from it. Tens of thousands of interruptions, eleven thousand of them longer than ten microseconds, the longest almost seven milliseconds. Those gaps are exactly the tail we saw in the ring buffer: a median hand-off of three hundred nanoseconds, but one in a hundred over a hundred microseconds. This computer is a virtual machine sharing hardware with strangers, which makes it noisy. Production trading servers are bare metal, with interrupts steered away from the trading cores, power saving switched off, and constant monitoring for exactly these spikes, because a race is lost in the tail, not the median.

What it establishes: Kernel bypass; one pinned, spinning core per job; a lock-free ring buffer (animated); false sharing; branch prediction; OS jitter and the tail.; Real data on screen: Ring buffer 15.7 M messages/s, median 300 ns, p99 156 µs; false sharing 46 vs 5.8 ns; branches 3.74 vs 0.47 ns; a pinned core interrupted 33,502 times in 10 s (11,209 > 10 µs, longest 6.9 ms, 3.4% of its time).

10Hardware: deciding before the packet ends3 min

Software, however well tuned, has a floor: the whole packet has to arrive, cross into memory, and be picked up by the processor before any code can look at it. The fastest firms don't wait. Here is that real Nvidia order again, wrapped in the headers it travels in: 104 bytes. On a ten-gigabit link, a byte arrives every eight tenths of a nanosecond, so the frame takes 83 nanoseconds to arrive, and the field that matters most, the price, comes almost last.

An FPGA is a chip full of programmable logic: instead of running instructions, you lay out a circuit. A trading firm lays out a pipeline: decode the network headers, check the sequence number, parse the message, compare it against a table of triggers, send an order. The bytes stream in, eight at a time, one chunk every 6.4 nanoseconds, and each stage works on its piece of the frame while the rest is still arriving. And the reply can start before the input ends: the outgoing order's headers are prepared in advance, so the circuit starts sending them while the price is still on its way in, and fills in the decision at the last moment, or aborts the frame if the answer is no.

How fast can this be? There's an industry benchmark for exactly this, called STAC-T0. The record, set in 2024 with an AMD FPGA card and Exegy's design, is a minimum of 13.9 nanoseconds from the last bit of the market data to the first bit of the order. In that time, light travels about four meters.

But a circuit can't think very hard. So the work is split. Software is the brain: it works out fair values, risk limits and strategy, at its own pace, and keeps rewriting tables of instructions inside the hardware: if the price in this stock crosses this level, send that order. The FPGA is the reflex: it watches every packet and fires the pre-planned response in nanoseconds. Jane Street designs its FPGAs in Hardcaml, an open-source hardware language it built inside OCaml, the programming language it uses for nearly everything. And the same thinking reaches the network itself: special layer-1 switches that copy a signal in a few nanoseconds instead of hundreds.

What it establishes: The real add order in its 104-byte frame (83 ns at 10 Gb/s); an FPGA pipeline that acts while the frame is still arriving; STAC-T0 13.9 ns; brain vs reflexes; Hardcaml; layer-1 switches.; Real data on screen: Frame layout of the real message (schematic pipeline).

11Part 4: Fair value3 min

Speed only matters if you know what to do with it. The other half of the machine is the brain: an estimate, updated on every message, of what the stock is really worth. Start with the simplest clue there is. Here a thousand shares are waiting to buy at the bid, and only a hundred are offered at the ask. Which way is the price more likely to move? The thin side is the one that's about to run out: one modest buyer clears the ask, and the price ticks up.

Let's test that on the real data. Define the imbalance as the fraction of the shares waiting at the best bid and the best ask that are on the bid side. Then, for every moment of the day when the spread was one cent, check which way the mid-price moved next. The relationship is almost a straight line. When nearly all the waiting shares are on the bid, SPY's next move was up 85 percent of the time; when they're nearly all on the ask, down 85 percent of the time. Free information, sitting in plain sight in the order book, for anyone fast enough to use it.

That gives us a first estimate of fair value. Instead of the plain mid-price, weight each side by the imbalance: with a thousand shares bid and a hundred offered, the imbalance is 0.91, and the fair price sits not halfway between bid and ask, but most of the way toward the ask. Researchers have refined this idea; Sasha Stoikov's version is called the microprice.

But it's a fleeting kind of knowledge. Here's how strongly the imbalance predicts the price change over the next millisecond, second, or minute. It's strongest about fifty milliseconds ahead, and a minute ahead it's worth nothing. Whatever it knows, the market learns almost immediately. A signal like this is only worth having if you can act on it within milliseconds, which is why the brain and the pipe have to be built together.

A real fair-value model combines many such clues. The stock's own order book, S&P 500 futures, arriving from Chicago by microwave, the same stock's quotes on a dozen other exchanges, related stocks and funds: an ETF and the hundreds of stocks inside it must agree, and keeping them in line has long been one of Jane Street's specialties. Options, and news. The models range from simple weighted averages to machine learning trained on years of data, which is why these firms run some of the largest computing clusters in finance. But every one of them produces the same thing, many times a second: a number, and how sure we are of it.

What it establishes: Order-book imbalance predicts the next move; the weighted mid / microprice; the signal decays within a second; fair value combines many sources.; Real data on screen: P(next mid move up | imbalance) over 4.4 M NVDA and 6.8 M SPY book states (one-cent spreads): 0.15 → 0.85 for SPY; correlation with the future change peaks ≈ 50 ms ahead and vanishes by 1 min.

12Quoting: spread, skew, inventory3 min

With a fair value in hand, the market maker has to decide exactly where to quote. And there's a complication we skipped: inventory. Every time a seller hits your bid, you own more stock. Get hit five times in a row and you're long five hundred shares. Now every cent the price falls costs you five dollars: the profit from ten round trips at a half-cent each, gone in a single tick. A market maker wants to be a middleman, not an investor.

In 2008, Marco Avellaneda and Sasha Stoikov worked out the optimal answer for a simple model of this problem. Don't center your quotes on the fair value s. Center them on a reservation price r, shifted against your inventory q: the more you own, the lower you go. The shift grows with your risk aversion, gamma, with the volatility, sigma squared, and with how long you expect to be stuck holding it. And the width of the spread has two parts: the same risk term, plus a term that depends on how quickly the chance of a fill falls off as you quote farther from the mid.

Here's what that does. With no inventory, the quotes sit symmetrically around fair value. As you get longer, both quotes slide down: your ask becomes more attractive, so you're likelier to sell, and your bid less attractive, so you're less likely to buy more. Short, and they slide up. And when volatility rises, the spread widens: the same inventory is now more dangerous to hold.

Here's the strategy running against a real minute of SPY, with its fills drawn at random the way the paper models them. The price swings through cents. The quotes ride along with it, and lean against the inventory. The inventory wanders, but it never runs away, because in this model whether you get filled has nothing to do with where the price goes next. That's the skeleton of a real quoting engine. But real fills are not random. As we're about to see on real data, you tend to get filled exactly when the price is about to move against you.

What it establishes: Inventory risk; Avellaneda–Stoikov reservation price and spread; skew with inventory and volatility (animated); the model on a real price path.; Real data on screen: SPY's mid 11:00–11:01 (a 44 ¢ swing), with quotes and fills simulated as in the paper (labeled).

13Testing on real queues4 min

Now the hardest question in this whole business: does a strategy actually make money? You test it on history, but your orders weren't in the history. So take the real Nvidia bid queue at 10:30 that morning, six real orders, and put a virtual order of our own at the back. Because the feed reports every order individually, we can track exactly which orders are ahead of us, and replay what really happened to them.

The replay: an order ahead of us is canceled, and we move up. Others join behind us and leave again. Another cancel ahead. Then, thirty-seven milliseconds in, a seller arrives and executes all four orders in front of us at once. We're at the front. A quarter of a millisecond later, a new order joins behind us and is executed immediately. In the real world that trade would have hit us first: we're filled, buying 100 shares at 183.85. And at that instant, the bid at 183.85 is gone. The price has just moved down through us. We bought exactly when the market was falling.

Now run that idea all day long. A simple market maker on Nvidia: always join the best bid and the best ask with a hundred shares, re-join whenever they move, never hold more than five hundred shares either way, and assume every action takes ten microseconds to reach the exchange. Every one of its orders is a virtual order, queued behind the real ones. For each fill, measure the profit against the mid-price, at the moment of the fill and at later moments. This is called a markout. At the instant of the fill, we've earned a sliver of the spread. One millisecond later, the price has moved against us by more than that, and it stays there. Over fills, the strategy loses about a quarter of a cent per share. That's adverse selection, measured: you get filled precisely when you least want to be.

Now change one thing: how long our actions take to reach the exchange. From one microsecond up to a hundred, the loss barely changes. At one millisecond it's almost half again as bad, and at ten milliseconds, twice as bad: our quotes sit there stale, waiting for our own cancels to arrive, while faster traders pick them off. Add the imbalance signal, stepping aside whenever the queue on our side gets thin, and the loss shrinks, but doesn't go away. Real market makers have help we didn't model. Exchanges pay a rebate for posting orders that others trade against: on Nasdaq, around a fifth to a quarter of a cent a share for the busiest firms, which is just about the size of the loss of our fastest version. And the real edge is in everything else we left out: being first in line when a new price level opens, and signals from futures, other exchanges and related stocks that see the move coming. This is why a firm's simulator, which has to replay every queue honestly, is one of its most valuable systems.

What it establishes: Virtual orders queued behind real ones; a real queue replayed until our order fills, as the price drops through it; markouts; latency and signal sweeps; rebates.; Real data on screen: NVDA, 9:45–3:45: "join the best" at 10 µs: 82,286 fills, markout +0.15 ¢ at the fill, −0.27 ¢ 1 ms later, −0.24 ¢/share overall; 1 µs → 10 ms latency: −0.24 → −0.50 ¢; with the imbalance signal −0.19 ¢ at 1 µs; median queue ahead 100 → 243 shares.

14Part 5: Risk, and Knight Capital3 min

The last stage before an order leaves is the one that keeps the firm alive. Every order passes through risk checks: is it too big? Is its price far from where we think the stock is worth? Would it push our position past its limit? Are we sending too many orders too fast? Would it use more capital than we have? And is the kill switch on? Because they run on every order, they have to be fast, and some firms build them into the same hardware as the reflexes. And they have to be independent of the strategy: the strategy is the thing they protect us from. In the United States, any broker with direct access to the market has been required to have such automated controls since 2010.

What happens without those checks? The most famous answer is Knight Capital, then one of the largest market makers in America, handling about a tenth of all U.S. stock trading. In late July 2012, Knight installed new code on the eight servers of its order router. A technician missed one. Server number eight still had a piece of old code called Power Peg, unused since 2003, and the new code reused a flag that, on that one server, switched Power Peg back on.

On the morning of August 1st, starting at one minute past eight, Knight's systems sent ninety-seven automated e-mails mentioning Power Peg. They weren't designed as alerts, and nobody acted on them.

At 9:30, server eight began working on 212 small customer orders, and for each one, it sent child orders to the market, again and again, because the code that counted how many shares had already been bought had been moved years earlier. Nothing stopped it. The engineers, trying to find the problem live, removed the new code from the seven good servers, which activated Power Peg on those too. In forty-five minutes: four million executions in 154 stocks, 397 million shares, a 3.5 billion dollar long position in eighty stocks, and a 3.15 billion dollar short position in seventy-four.

Unwinding those positions cost Knight 460 million dollars, more than the firm could survive on its own. Within days it needed a rescue, and within a year it had been merged away.

The SEC's findings are a checklist of everything in that risk gate. There was no automated, firm-wide capital limit connected to order entry. The account that filled up with unwanted shares had a two-million-dollar limit, but it wasn't wired to anything that could stop the orders. Position monitoring depended on people watching a screen. Nobody double-checked the deployment, and there was no plan for an incident. Today's top firms treat these as part of the trading system itself: limits on every order, kill switches, every fill reconciled against the exchange's own record, and deployments rehearsed and automated, so that a mistake costs seconds, not a company.

What it establishes: Inline pre-trade checks (SEC Rule 15c3-5). Knight Capital, August 1, 2012, from the SEC's order. What was missing.; Real data on screen: Facts from the SEC order (Release 34-70694). Position growth over the 45 minutes is drawn linearly (schematic).

15Determinism and the research loop3 min

Remember the exchange's trick: put every input in one numbered line, and make every component a deterministic function of that line. The best trading systems are built the same way. Every input, every market data packet, every acknowledgment from the exchange, even the ticks of the timer, is recorded in order, with a timestamp from the network hardware. The live system reads that stream, and so can a copy of exactly the same code, later, and it will make exactly the same decisions, message for message. That lets you explain any decision after the fact, test new code against last month's markets, and restart a crashed process by replaying its log. It's how Jane Street describes building its own systems, and it's why the simulator and the trading system are, as far as possible, the same program.

To line up events from many machines, and to measure your own latency honestly, every clock has to agree. Left alone, computer clocks drift apart by microseconds every second. So firms discipline them all from a master clock locked to GPS satellites, using a network protocol called PTP, with timestamps applied in the network hardware itself. Regulators care too: in Europe, high-frequency traders must keep their clocks within a hundred microseconds of official time and record events to the microsecond.

And then the whole machine sits inside a bigger loop, the one that makes it better. Data: every message from every venue, kept for years. Research: ideas and models, fitted on big computing clusters. Simulation: replaying the real queues, honestly, with your orders in them. A small live test, and measurement: did the fills, the markouts and the latency look the way the simulator said they would? If not, that difference is the most valuable data of all. The firms differ in style. Jane Street writes nearly everything in OCaml, a language whose strict types catch many mistakes before the code ever runs. Hudson River Trading puts C++ at the center of its trading systems and its research infrastructure, and says it has built one of the world's most advanced computing environments. But all of them run this loop, every day.

What it establishes: A sequenced, timestamped input log; deterministic replay; the simulator as the same program; clocks (PTP, GPS; MiFID II RTS 25); the research loop; firm styles (OCaml at Jane Street, C++ at HRT).

16The whole machine2 min

So here's the whole machine again, with what we found at every stage. An exchange that puts every event in one line, on one thread, and multicasts the result to everyone at once. A feed handler that arbitrates two copies of the feed and bypasses the operating system. An order book that absorbs a message in tens of nanoseconds. A fair value built from clues that fade within a second, quotes that lean against inventory, risk checks on every single order, and, at the extreme, hardware that answers before the question has finished arriving. All of it racing the speed of light between Chicago and New Jersey, and other machines whose full round trip, on that ordinary Wednesday, took about twenty microseconds.

To recap. A market maker earns fractions of a cent, and loses them to better-informed traders, so it must be both right and fast. Exchanges are single-threaded sequencers that broadcast by multicast, and nearly all of their traffic is quoting, not trading. Prices that move together over minutes move independently over milliseconds, and that's where the races happen. Distance is time, so firms bend radio waves along the shortest path and fight over meters of cable. Inside the box, they avoid the operating system, pin work to cores, and fight the slow tail. Hardware handles the reflexes. Fills are adversely selected, so everything is tested against real queues. And risk checks aren't paperwork: they're part of the machine.

Every chart of market data in this video came from one real day of Nasdaq's feed, and every timing measurement from the computer that made the video. The sources are listed in the description. Thanks for watching.

What it establishes: The whole machine annotated with what we found; recap; credits.

Notes and sources

Sources

What is computed and builtData (compute.py → data/.json)
Item What Used in
itch Downloads S121025-v50.txt.gz (11,557,662,295 bytes) from Nasdaq's public sample directory (emi.nasdaq.com/ITCH) and scans it once with native/itch_scan.c (9.4 min): counts by type, per-ms rates, per-µs bursts, order lifetimes, post-trade reaction gaps, and per-stock record files for SPY IVV VOO QQQ NVDA AAPL TSLA all
day the day's totals, per-second profile, peaks 1, 3, 4
windows every message 13:59:58–14:00:03 by type (native/itch_window.c), and the Netflix burst 1, 3, 4
messages real NVDA messages, byte for byte 4, 5, 10
book NVDA's book at 10:30:00, 13:59:59, 14:00:01 with every order; the time-weighted spread; 80 real messages after 10:30:00 2, 13
bookbench the whole SPY day through a Python book and native/book.c 5, 16
race reaction and lifetime histograms; SPY/IVV/VOO mid-prices and their return correlations at 18 time scales 6, 12
signal imbalance → next move; correlation with future changes at 16 horizons 11
mm the market-making backtest (10 runs in one pass) 13
bench native/bench.c on this machine 5, 8, 9
geo coordinates, distances, map outlines 7

Method notes

  • The day. Timestamps are Nasdaq's own (nanoseconds since midnight, the matching engine's event time). "Regular session" is 9:30:00–16:00:00. "Busiest second" is over the whole day; the busiest ones (1.75 M at 16:00:02) come right after the close, when the closing cross prints and day orders are canceled. The busiest second of the regular session was 14:40:07 (933,181).
  • Before 2:00 pm. In the 100 ms starting 13:59:59.5 there were 21,868 messages, 16,157 of them Order Delete, across 1,431 stocks. The video calls this firms pulling quotes, which is what deletes are; it does not identify who sent them. The burst in the first ~200 µs after 14:00:00.000 cannot be a reaction to the announcement (the news originates in Washington, ~1 ms of light-travel away), so the narration only speaks of the following seconds.
  • Order book. Prices are bucketed to whole cents (all displayed prices of these stocks are). Five SPY orders at the maximum price ($199,999.00, stub quotes) share the top level in the C book. The Python and C books agree on the final state.
  • Reaction gaps. For every execution (E, C, P) in the regular session, the time to the next non-execution order message (A, F, D, X, U) in the same stock. It includes the reacting firm's whole round trip through Nasdaq's systems, and some messages unrelated to the trade.
  • Lifetimes. For orders added during the regular session and removed during it: time from add (or replace) to delete. "Never trade": 13,772,814 of 501,302,973 added orders had any execution.
  • Correlations. Mid-prices from Nasdaq's book only (not the national best bid and offer), sampled on a regular grid 9:35–15:55, log returns, zero-zero pairs dropped.
  • Imbalance. Q_bid / (Q_bid + Q_ask) at the best prices, at every change of the top of book with a one-cent spread; "next move" is the next change of the mid.
  • Backtest. One pass over NVDA's messages, 9:45–15:45. Each run quotes 100 shares at the best bid and ask, re-joins when they move, caps inventory at ±500 shares, and delays every place/cancel by its latency. A virtual order records the real orders ahead of it at arrival; executions and cancels of those orders move it up; an execution of an order behind it (or at a worse price on its side) fills it. Virtual orders do not affect the real market, there are no fees or rebates, and inventory is marked to the mid at 3:45. Markouts are against the mid at the fill time plus the horizon. Rebates: Nasdaq's 2025 rule filings list credits of $0.0020–$0.0027 per share for displayed liquidity in its DLP tiers.
  • Machine. A KVM virtual machine, 4 vCPUs of an Intel Xeon @ 2.10 GHz (L1d 48 KiB, L2 2 MiB per core, L3 260 MiB shared). Latencies are medians unless stated. Pointer chasing uses a random single-cycle permutation of 64-byte lines; huge pages via madvise(MADV_HUGEPAGE). Ping-pong numbers are half the round trip.
  • Geography. Great-circle distances on a sphere of radius 6,371.0 km; light in fiber with group index 1.468.
Chapter notes
# Scene What it establishes Real data on screen
1 Hook Nasdaq in the seconds around the Fed's 2:00 pm decision: firms pull quotes, then flood back. The day's shape. The firms. The trading loop, tick to trade. Messages per 0.1 s by type, 13:59:58–14:00:03 (16,157 deletes in the 100 ms at 13:59:59.5, across 1,431 stocks); busiest second in every 10 s, 9:00–4:30; 846.8 M messages, 27.0 GB.
2 TheJob The order book, queue by queue. The spread. Two-sided quoting earns the spread; informed traders cost more than uninformed ones pay (adverse selection); Glosten–Milgrom: s/2 = πΔ. Be right and be fast. NVDA's book at 10:30:00.000, every order; the day's time-weighted spread, 1.108 ¢. Price path is schematic.
3 TheExchange Gateways → one sequencer → one matching thread. Price-time priority. One Netflix order trading against 4,076 resting orders, stamped with one nanosecond. Unicast vs multicast (Nigito's 600 µs). The message mix. State machine replication (Jane Street's JX). NFLX at 10:38:37.273156756 (4,108 messages at one ns); regular-session mix: new 34.9%, replaced 27.5%, canceled 34.2%, executions 2.0%; 97.3% of orders never trade.
4 TheFeed A real Add Order, 36 bytes decoded field by field; Delete, Execute, Replace; MoldUDP64 packets, A/B arbitration, gaps. Volume and bursts. NVDA's first messages after the open (buy 100 @ 180.35, order #54,010,847, 09:30:00.001333600); 34,311 messages/s average, 1,752,575 in the busiest second; the Netflix burst ≈ 136 kB ≈ 108 µs on a 10 Gb/s wire.
5 BuildingTheBook Price-level array + FIFO lists + hash map, animated for a real add and delete. Python vs C on the whole SPY day; pre-faulting memory; the per-update tail. 14,953,094 SPY messages: Python 777 ns/message, C 38 → 35 ns (6,819 page faults removed); per-update median 67 ns, 99.99th pct 14 µs. Both books agree at end of day.
6 TheRace SPY/IVV/VOO: lockstep over a day, independent within a second; correlation collapses at short horizons (Epps effect; Budish et al.). Stale quotes and latency-arbitrage races (Aquilina, Budish & O'Neill). The reaction spike. Fleeting orders. Mid-prices of the three ETFs on Nasdaq; SPY–IVV return correlation 0.999 (1 min), 0.96 (1 s), 0.50 (10 ms), 0.23 (1 ms), 0.04 (0.1 ms); 11.4 M gaps from a trade to the next order message: mode 20–25 µs; 14% of deleted orders deleted within 1 ms, 42% within 0.1 s.
7 SpeedOfLight Aurora → Carteret: 1,178 km; light in vacuum 3.93 ms; straight fiber 5.77 ms; Spread Networks' 2010 route 13.33 ms round trip; microwave 3.982 ms (2016), 53 µs (1.3%) above the vacuum limit. The race, slowed down. Colocation and equal-length cables. Data-center coordinates from OpenStreetMap; outlines from Natural Earth. Tower positions and the fiber route's shape are schematic.
8 LatencyLadder The memory hierarchy measured: L1 ≈ 1.5 ns, L2 ≈ 5 ns, L3 ≈ 30–75 ns, DRAM ≈ 200–290 ns; the TLB (HRT's huge-pages post) and huge pages measured; the ladder of everything, at human scale. Pointer chasing 4 KiB–1 GiB, 4 KiB vs 2 MiB pages (1 GiB: 291 → 207 ns); syscall 102 ns; core-to-core 220 ns; kernel UDP 2.8 µs spinning / 14.2 µs asleep.
9 HotPath Kernel bypass; one pinned, spinning core per job; a lock-free ring buffer (animated); false sharing; branch prediction; OS jitter and the tail. Ring buffer 15.7 M messages/s, median 300 ns, p99 156 µs; false sharing 46 vs 5.8 ns; branches 3.74 vs 0.47 ns; a pinned core interrupted 33,502 times in 10 s (11,209 > 10 µs, longest 6.9 ms, 3.4% of its time).
10 Hardware The real add order in its 104-byte frame (83 ns at 10 Gb/s); an FPGA pipeline that acts while the frame is still arriving; STAC-T0 13.9 ns; brain vs reflexes; Hardcaml; layer-1 switches. Frame layout of the real message (schematic pipeline).
11 FairValue Order-book imbalance predicts the next move; the weighted mid / microprice; the signal decays within a second; fair value combines many sources. P(next mid move up | imbalance) over 4.4 M NVDA and 6.8 M SPY book states (one-cent spreads): 0.15 → 0.85 for SPY; correlation with the future change peaks ≈ 50 ms ahead and vanishes by 1 min.
12 Quoting Inventory risk; Avellaneda–Stoikov reservation price and spread; skew with inventory and volatility (animated); the model on a real price path. SPY's mid 11:00–11:01 (a 44 ¢ swing), with quotes and fills simulated as in the paper (labeled).
13 Backtest Virtual orders queued behind real ones; a real queue replayed until our order fills, as the price drops through it; markouts; latency and signal sweeps; rebates. NVDA, 9:45–3:45: "join the best" at 10 µs: 82,286 fills, markout +0.15 ¢ at the fill, −0.27 ¢ 1 ms later, −0.24 ¢/share overall; 1 µs → 10 ms latency: −0.24 → −0.50 ¢; with the imbalance signal −0.19 ¢ at 1 µs; median queue ahead 100 → 243 shares.
14 Risk Inline pre-trade checks (SEC Rule 15c3-5). Knight Capital, August 1, 2012, from the SEC's order. What was missing. Facts from the SEC order (Release 34-70694). Position growth over the 45 minutes is drawn linearly (schematic).
15 ResearchLoop A sequenced, timestamped input log; deterministic replay; the simulator as the same program; clocks (PTP, GPS; MiFID II RTS 25); the research loop; firm styles (OCaml at Jane Street, C++ at HRT).
16 Outro The whole machine annotated with what we found; recap; credits.
The visual language
Concept Color
bids / asks green / coral
the market maker's own quotes and fills gold
trades, executions yellow
market-data messages (incoming) / orders (outgoing) pale blue / orange
cancels grey
latency, clocks, timing teal
the operating system: kernel, interrupts, jitter rose
L1 / L2 / L3 / main memory light blue → violet
FPGAs lavender
microwave / fiber / light in vacuum teal / orange / yellow
fair value, signals pink
inventory brown

Build the film

python -m videos.markets.trading.compute        # the film's numbers, into .cache/trading
python tools/build.py trading                  # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py trading Hook   # one chapter, silent, with a contact sheet

Scenes: videos/markets/trading. Setup: see the course page. Source of these notes: the README and the scenes' narration.