What a stock exchange actually does
Understand an exchange as an ordered market that accepts constrained orders, discovers prices, publishes trades, and hands obligations downstream.
Guided learning track
A complete electronic trading venue evolved from three-nines operation through five-nines durability and low-latency fairness.
Orientation · Tutorial 1 of 39
Map the exchange's jobs, full functional surface, and availability budget before building the trading system.
Understand an exchange as an ordered market that accepts constrained orders, discovers prices, publishes trades, and hands obligations downstream.
Map functional flows, scale, latency, consistency, availability, and recovery requirements before committing to component boundaries.
Convert availability percentages into concrete downtime and failed-request budgets before choosing an architecture.
Build a complete working exchange with deterministic trading, market data, risk, post-trade, scaling, and replay recovery.
Decompose an exchange into order entry, risk, matching, market data, and post-trade boundaries connected by explicit event flows.
Trace an order through validation, risk, sequencing, matching, acknowledgement, market data, and post-trade processing.
Represent bids and asks so the matcher always selects the best price first and preserves arrival order within each price level.
Encode accepted, active, partially filled, filled, canceled, and rejected transitions so retries cannot produce impossible order states.
Translate order types and time-in-force rules into explicit matching constraints so execution behavior is deterministic and testable.
Use auctions, volatility controls, and trading halts to restore orderly price discovery when continuous matching becomes unsafe.
Make every matching decision a deterministic function of an ordered event log so replicas can replay and recover identical state.
Publish sequenced snapshots and incremental updates through a fanout path that lets consumers detect gaps and rebuild state.
Keep matching fast and safe by checking balances, positions, limits, and custody constraints before an order reaches the book.
Separate execution from clearing and settlement, carrying immutable trades into obligations, netting, and final asset transfer.
Scale participants by partitioning session and market-data fanout while preserving a narrow, deterministically ordered matching core.
Achieve a credible three-nines baseline by persisting ordered events and rebuilding deterministic state after process crashes.
Remove single points of failure through replicated state, reliable messaging, automatic leadership, overload defense, and multi-site operation.
Audit every critical request path for single points of failure, including hidden dependencies shared across otherwise redundant components.
Replicate an ordered input log to a hot standby so deterministic replay produces a ready-to-promote copy of matching state.
Sequence messages and repair detected gaps with NAKs, retransmission, and snapshots instead of pretending packet delivery is perfect.
Decouple durable session identity and sequence state from individual gateways so clients can reconnect without duplicating or losing orders.
Deploy compatible, reversible changes with canaries, dual-version protocols, and staged migrations so trading continues during upgrades.
Combine failure detection, quorum-backed leases, fencing, and epochs so only one matching leader can accept orders.
Protect order entry and matching with admission control and load shedding, degrading noncritical work before queues collapse.
Reach four nines by spreading critical components across zones, removing shared failure domains, and automating bounded failover.
Assemble multi-zone redundancy, automated failover, durable logs, and overload controls into a coherent four-nines exchange.
Apply synchronous durability, regional recovery, cells, gray-failure detection, and safe change to the paths that stop trading.
Reserve five-nines engineering for the trading paths whose failure causes the most harm, and give supporting systems cheaper targets.
Keep consensus out of per-order execution where possible, using it to establish ownership while a single leader orders the hot path.
Survive regional loss with preplanned traffic shifts, fenced ownership, replicated state, and explicit recovery-point trade-offs.
Partition the exchange into self-contained cells so overload or failure in one market segment cannot consume the whole platform.
Expose partial and ambiguous failures with targeted probes and chaos drills that verify detection, isolation, and recovery before production does.
Treat deployment as a failure mode and reduce its blast radius with staged rollout, compatibility, observability, and fast rollback.
Assemble cells, multi-region ownership, static stability, and disciplined operations into a five-nines design with bounded failure domains.
Connect order entry, risk, deterministic matching, market data, clearing, and recovery into one end-to-end exchange design.
Measure and reduce wire-to-wire latency and jitter while preserving durability, fairness, and the availability architecture.
Control latency variance across participants because unequal access time can distort price-time priority even when matching is correct.
Measure end-to-end latency with coordinated timestamps, percentiles, and realistic load so queues and tail behavior remain visible.
Reach millisecond latency by shortening synchronous paths, bounding queues, colocating dependencies, and eliminating avoidable network hops.
Reach microsecond latency by aligning data layout, CPU affinity, memory access, and network I/O with the hardware's actual costs.
Treat tail latency and jitter as first-class outcomes because unpredictable delay undermines both throughput and participant fairness.
Turn fairness into enforceable ordering rules, synchronized ingress, and auditable timestamps rather than relying on average latency.
Resolve reliability–latency conflicts by keeping the hot path minimal while moving replication and recovery work to carefully bounded boundaries.