fivenines
5/39
Lesson 1.2

The life of an order

What you'll learn

The exact sequence of steps between "trader clicks buy" and "the whole market knows" — the spine every later lesson hangs detail on.

Building on

The tiers from 1.1. This lesson rides one order through all of them.

Worked example

Alice submits: buy 100 shares of ACME, limit price 10.00. The book currently has no sellers at 10.00 or better, so her order will rest. Later, Bob's sell arrives and fills it. Follow the numbers in the diagram:

sequenceDiagram
    autonumber
    participant A as Alice
    participant G as Gateway
    participant R as Risk
    participant M as Matching engine
    participant D as Market data
    A->>G: buy 100 ACME limit 10.00
    G->>G: session valid? symbol known? price on tick?
    G->>R: order forwarded
    R->>R: reserve 1000.00 of Alice's buying power
    R->>M: order accepted into core
    M-->>A: ACK — order live, resting on book
    M->>D: quote update: bid 10.00 x 100
    Note over M: minutes later, Bob sells 100 at 10.00
    M-->>A: FILL — 100 at 10.00
    M->>D: trade print: 100 at 10.00
    D-->>A: everyone sees the new price
    
One order, end to end. Steps 2 and 4 can each reject — cheap failures are pushed as early as possible. Steps 6–7 and 9–10 show the invariant: every private outcome (ACK, FILL) has a public twin (quote, trade print).

Three rules of the road, visible in the diagram:

  • Reject early, reject cheap. Syntax and session checks happen at the stateless edge (step 2); a malformed order never costs core capacity. Risk (step 4) is the last gate before the order becomes the market's problem.
  • The ACK is a promise. After step 6, Alice's order is part of the market. It will be honored even if Alice disconnects — until she cancels or it expires.
  • Private and public messages are two views of one event. The fill Alice receives and the trade print the market receives are generated from the same match, atomically. If they could diverge, arbitrageurs would find the gap within days.
Key ideas
  • Validate at the edge, gate at risk, decide at the engine, publish to all.
  • ACKed orders are commitments that outlive the client's connection.
  • Private fills and public prints are one atomic event, split into two audiences.
Next step

See what actually stuck.

Take the practice scenarios now.