MARKET SYSTEMS · COURSE 001

The Millisecond That Matches an Order

Turn an order book into a deterministic queue. Follow price-time priority, market impact, cancel-replace, self-trade prevention, and frozen assets as one verifiable state machine.

4 lessonsabout 48 minbeginner friendly
COURSE EXAMPLEWho should fill first in a single millisecond?

Treat an order book as a deterministic queue and inspect price, time, depth, remainder, and frozen assets.

PARTICIPANTS
  • AMaker A: enters first and supplies liquidity
  • BMaker B: queues at the same price
  • YouTrader: crosses the spread
  • MEEngine: executes explicit rules
COURSE OUTLINE

One question per lesson

The lessons are ordered so that each one uses concepts introduced earlier.

  1. 01
    PRICE · TIME · QUEUE

    Who Should Fill First?

    KEY QUESTIONI submitted first. Why can someone else fill first?

    Put orders into one deterministic queue and observe price priority, time priority, resting prices, and partial fills.

    Best bid / askPrice-time priorityResting order pricePartial fillCancellation
    11 MIN
  2. 02
    MARKET · DEPTH · IOC

    What Does a Market Order Consume?

    KEY QUESTIONDoes a market order really mean ‘buy at any price’?

    Sweep a sell book level by level and separate immediate fills, average execution, and an unmatched IOC remainder.

    Market orderMarket depthAverage executionIOC
    12 MIN
  3. 03
    SPREAD · MAKER · TAKER

    Who Leaves the Spread Behind?

    KEY QUESTIONThe spread is only 1. Why can a large order still be expensive?

    Read the book as waiting inventory and compare spread, level depth, and the real cost of a sweep.

    SpreadMakerTakerLiquidityTrading cost
    12 MIN
  4. 04
    CANCEL · REPLACE · SELF-TRADE

    Why Does a Price Change Rejoin the Queue?

    KEY QUESTIONWhy lose queue priority when improving an order’s price?

    Cancel and reprice an order, then observe time priority reset and self-trade prevention block a false fill.

    Cancel-replaceSelf-trade preventionFrozen assetsOrder lifecycle
    13 MIN
WHAT IT COVERS

Questions covered in this course

01

Why do best bid and best ask determine the next match?

02

Why does the earlier order fill first at the same price?

03

Why can a large order fill partly while the remainder queues?

04

How does a market order sweep levels, and why does its average worsen?

05

How do repricing, self-trade prevention, and freezes protect the book?