Post-Mortem Lab

Knight Capital: an old switch and a forgotten server

On 1 August 2012, one of eight servers missed an update, and an old program woke up. In 45 minutes it traded nearly 400 million shares nobody asked for, and lost over $460 million. Run the morning yourself.

Ref
EP-05
Date
Module
Post-Mortem Lab
Source
ep-05

▶ Watch · the episode

On 1 August 2012, the New York Stock Exchange opened at 9:30 as usual. Over the next 45 minutes, the computers of one firm, Knight Capital, bought and sold more than 397 million shares that none of its customers had asked for. By the time they were stopped, Knight had lost more than $460 million.

Run the morning

Press Run the morning. Each box is one of Knight’s eight servers. Watch the eighth, then what happens when staff try to fix it. Then switch on any one of the fixes and run it again.

Fig. 06 Knight Capital · 9:30 to 10:15 a.m.
On the morning
Fixes
9:30a.m. ET

new code old code running away stopped by the brake

Trades made
0
Shares
0
Loss
$0
9:3010:15$460M

    What happened

    Every step comes from the SEC’s order against Knight (2013).

    The New York Stock Exchange trading floor, crowded with trading booths, screens and traders
    The New York Stock Exchange trading floor. By 2012, most trading happened between computers.Photo: Carol M. Highsmith, Library of Congress · Public domain
    1. A retired program, still there. Knight stopped using a feature called Power Peg in 2003, but left its code on the servers, still able to run.
    2. Its counter was moved. In 2005, the part of Power Peg that counted shares and told it to stop was moved elsewhere in the code. Nobody retested Power Peg afterwards.
    3. A reused switch. In 2012, Knight wrote new code for a new NYSE service, the Retail Liquidity Program. The new code replaced Power Peg and reused the switch that used to turn Power Peg on.
    4. Seven of eight. From 27 July, a technician copied the new code onto the servers by hand. One of the eight was missed. No second person checked, and there was no written procedure saying someone should.
    5. Warnings nobody read. From 8:01 on the morning of 1 August, Knight’s systems sent 97 automatic emails mentioning “Power Peg disabled”. They weren’t designed as alerts, and nobody acted on them.
    6. 9:30. Orders arrived with the switch on. Seven servers ran the new code. The eighth ran Power Peg, which sent orders again and again, with no idea that each customer’s order was already done.
    7. The fix that made it worse. Trying to find the problem, staff uninstalled the new code from the seven good servers. Those servers now had the old code too, and started doing the same thing.
    8. About 45 minutes. By the time it stopped: over 4 million trades in 154 stocks, more than 397 million shares, about $3.5 billion of stock Knight hadn’t meant to buy and $3.15 billion it hadn’t meant to sell. The loss was over $460 million.
    Rows of server computers in racks, with blinking lights
    Servers in racks, like the eight that ran Knight’s router. (This photo is from an observatory, not Knight.)Photo: NOIRLab/NSF/AURA/T. Slovinský · CC BY 4.0

    Fix it

    Any one of these would have stopped it. In the simulation, each one brings the loss to zero.

    Fix What changes
    A second person (or a script) checks all eight servers before the open The missed server is found and updated; nothing runs away
    Delete old code instead of reusing its switch On the missed server, the switch does nothing at all
    An automatic brake: a server that sends more than it was asked for stops itself Each runaway server stops within a second

    The SEC’s order is mostly about the third kind of fix. It found that Knight had no control comparing the orders leaving its router with the orders coming in, and no automatic limit that stopped trading when the firm’s exposure grew too large. Knight was fined $12 million.

    In the lab’s toolkit, verifyFleet is the second pair of eyes: it checks every server reports the expected version and names the ones that don’t.

    What I simplified

    The SEC’s order gives the totals but not the minute-by-minute detail. In the simulation, each server gets one order with the switch on every minute, the staff rollback happens at 9:51 (the order doesn’t say when), and the loss grows with every unwanted share. Those choices are illustrative, tuned so the run that matches the real morning ends at the SEC’s totals: about 212 orders through Power Peg, 4 million trades and $460 million.

    Knight’s own estimate the day after was $440 million, which is the figure many articles quote. This page uses the SEC’s final figure.

    §

    Further reading

    Primary sources first. Everything here is free to read or watch.