Module 6 · Interview Prep: A Stock Exchange Matching Engine Lesson 38 of 54

Invariants for an Exchange

Price then time, no order lost, the same trades on replay, and every order answered.

1:59 clip1:24:55–1:26:54 in the full courseWatch on YouTube

Transcript

28 sentences · select one to jump there

Check your understanding

Two sell orders wait at $184.25: A arrived first, B a moment later. A buy arrives that can take only one of them. Which trades?

Choose one answer

Lesson notes

The rule

Write every input down before acting on it: a crash must never lose an accepted order