Fintech & Banking
Capital Markets for Engineers: Instruments, Venues and the Trade Lifecycle
Intermediate8 min readUpdated
Capital markets software is built around one long conveyor belt: an order becomes an execution, executions become trades, trades are confirmed, cleared, margined and finally settled. This guide follows that belt end to end and names the instruments, venues, identifiers and protocols an engineer meets at each stage.
What you will learn
- Distinguish primary from secondary markets and the four main instrument families
- Follow a trade from order entry through matching, clearing and CSD settlement
- Explain novation, central counterparties and why margin exists
- Read a FIX message and identify instruments correctly with ISIN, LEI and MIC
- Recognise the latency, data-volume and correctness constraints of trading systems
Trading systems have a reputation for arcane vocabulary, and it is deserved, but the domain underneath is surprisingly mechanical. An order is an instruction. A venue matches instructions into executions. Executions are aggregated into trades, confirmed with a counterparty, guaranteed by a clearing house, and finally exchanged for cash in a depository's books. Every job title, message format and system in the industry attaches to one link of that chain.
This guide follows the chain from end to end for someone who has just joined a team building order management, market data or post-trade software. It stays on market structure and plumbing; the economics — interest rates, valuation, risk categories — are handled separately in an introduction to financial markets. Everything here is educational explanation of infrastructure, not investment advice.
Primary and secondary markets
In the primary market, an instrument is created and sold by its issuer: a company floating shares, a government auctioning bonds, a fund launching units. The proceeds go to the issuer and the process is heavily documented — a prospectus, a syndicate of banks, a bookbuild, an allocation.
In the secondary market, that instrument changes hands between investors. The issuer receives nothing further; what the secondary market provides is liquidity and continuous price discovery, which is precisely what makes the primary market viable. Almost all trading technology serves the secondary market.
The instrument families
Each family is a different contract with different obligations, and those obligations dictate the data model.
Equities. A share is ownership: a residual claim on the company after everyone else has been paid, usually with a vote. Corporate actions — dividends, splits, mergers, rights issues — mutate positions and historical prices, and handling them correctly is one of the hardest parts of a securities system.
Bonds and other debt. A loan in tradable form: a promise to pay coupons on a schedule and the principal at maturity. Bonds carry accrued interest, day-count conventions, call features and credit ratings. Their price and yield move inversely, and the arithmetic is present-value arithmetic.
Funds. Pooled vehicles. Traditional mutual funds are typically bought and sold at a net asset value struck once per day, while exchange-traded funds trade continuously like shares — two very different lifecycles behind a similar-looking product.
Derivatives. Contracts whose value derives from something else. A forward or future obliges both sides to a transaction at a future date at an agreed price; an option gives one side a right and the other an obligation; a swap exchanges two streams of cash flows. Futures and standardised swaps are exchange-traded or centrally cleared, while bespoke contracts are negotiated over the counter. Derivatives introduce lifecycle events — resets, fixings, exercises, expiries — that a simple buy-and-hold model cannot express.
Venues and participants
Trading happens in several kinds of place, and the differences are regulatory as much as technical.
- A regulated market (an exchange) runs a transparent central order book with published rules and non-discretionary matching.
- A multilateral trading facility does much the same under a lighter authorisation, often specialising in a segment.
- Systematic internalisers and other dealer models execute client orders against the dealer's own book.
- Over the counter covers bilateral negotiation, still dominant in bonds and bespoke derivatives.
- Dark venues allow large orders to rest without displaying quotes, reducing the market impact of trading in size; they are constrained by transparency rules precisely because pre-trade opacity is a privilege.
On the participant side: buy side firms (asset managers, pension funds, hedge funds) own the money and generate the orders; sell side firms (brokers, dealers, investment banks) provide execution, liquidity and financing; market makers quote two-sided prices continuously and earn the spread; custodians hold the assets; central counterparties and central securities depositories run the post-trade machinery.
Order books and market data
The canonical secondary-market mechanism is the limit order book: resting buy orders (bids) and sell orders (offers) sorted by price, then by time at each price level. A marketable order crosses the spread and executes against the best available resting orders.
Order book — instrument XYZ, price/size, best at top
BIDS OFFERS
qty price price qty
1,200 101.20 | 101.25 800
500 101.19 | 101.26 2,000
3,400 101.18 | 101.28 150
spread = 101.25 - 101.20 = 0.05 mid = 101.225
Incoming: BUY 1,000 @ market
-> 800 filled at 101.25, 200 filled at 101.26
-> new best offer becomes 101.26 for 1,800
Matching is normally price-time priority: better price first, and among equal prices the order that arrived first. That single rule explains the industry's obsession with latency, because time priority is a queue position with monetary value.
Market data comes in tiers: level 1 (best bid, best offer, last trade), level 2 (aggregated depth per price level), and full depth or order-by-order feeds. Volumes are large and bursty, updates are conflatable but trades are not, and consumers need consistent snapshots plus incremental updates with sequence numbers so a gap can be detected and recovered. The architectural patterns are those of any high-throughput event system — see Kafka architecture for the log-based approach and reactive systems for back-pressure — with the caveat that on the latency-critical path, firms use kernel-bypass networking and custom binary protocols rather than general-purpose brokers.
The trade lifecycle
Follow one order all the way through.
Order capture
A portfolio manager decides to buy; the order management system records it against a fund or book, checks mandate and compliance limits, and reserves buying power.Routing and execution
An execution management system slices the order and routes the child orders to venues, possibly using an algorithm (VWAP, implementation shortfall) to control market impact. Each fill comes back as an execution report.Allocation
Executions are averaged and allocated across the underlying client accounts or funds that the block order was raised for.Confirmation and affirmation
Broker and investor exchange the economic details and agree them. Any mismatch found here is cheap; found later it is expensive.Clearing
For cleared markets, the trade is registered with a central counterparty, which novates it and calculates margin and net delivery obligations.Settlement
On the settlement date, the central securities depository moves securities between accounts against payment, usually with delivery-versus-payment so neither leg can happen alone.Custody and servicing
The custodian updates positions and thereafter handles income, corporate actions, tax and reporting.
Two mechanisms deserve a closer look. Novation is the legal move that makes central clearing work: the bilateral contract between buyer and seller is torn up and replaced by two contracts facing the CCP. Nobody needs to assess anybody else's creditworthiness, and exposures across the whole market can be netted down to a fraction of gross.
Margin is what makes that safe. Initial margin is collateral posted upfront to cover the cost of closing out a defaulting member's positions; variation margin is exchanged as prices move, so unrealised losses are settled continuously rather than accumulating. Behind both sits a default fund and a documented waterfall of who absorbs losses in what order.
Delivery versus payment is the settlement counterpart of the same instinct — the atomicity guarantee of the securities world. The stock leg and the cash leg either both complete or neither does, which is conceptually the same problem as the distributed transaction patterns in ordinary software, solved by a central party owning both legs.
The settlement cycle has been compressing. Major markets have moved, or are moving, from two business days after trade date to T+1. There is no more overnight slack for manual fixes: allocation, confirmation, funding and foreign exchange must all complete on trade date, which turns yesterday's tolerable batch process into today's outage.
Identifiers and reference data
Trade data is meaningless without reference data, and mis-identification is a classic source of expensive incidents.
| Identifier | Identifies | Shape |
|---|---|---|
| ISIN | A security | 12 characters: country prefix, national number, check digit |
| LEI | A legal entity | 20 characters, globally issued and openly published |
| MIC | A market or venue | 4 letters |
| CFI | The instrument's type and features | 6 letters, classification not identity |
| CUSIP, SEDOL | National security numbers | Regional, often embedded in an ISIN |
Rules that repay the effort: never key an instrument on its ticker, which is reused and reassigned; store identifiers with their scheme and validity period rather than as a bare string; keep an internal surrogate identifier and map external ones onto it; and treat reference data as versioned, effective-dated records, because a security's attributes legitimately change over time.
Protocols: FIX on the wire
FIX — Financial Information eXchange — is the lingua franca of order flow. The classic tag-value encoding is a stream of tag=value pairs separated by the SOH control character, with a session layer providing sequence numbers, heartbeats and gap-fill recovery. Later encodings (FIXML, Simple Binary Encoding, FIXP) target verbosity and latency respectively, but the semantics carry over.
8=FIX.4.4|9=<len>|35=D|49=BUYSIDE01|56=BROKER07|34=214|52=20260907-09:14:02.117|
11=ORD-20260907-000431|55=XYZ|48=GB0001234567|22=4|54=1|38=10000|40=2|44=101.20|
59=0|60=20260907-09:14:02.101|10=<checksum>|
9/10 body length and checksum, computed by the engine
35=D message type: NewOrderSingle 54=1 side: buy
11 client order id (must be unique) 38 order quantity
55/48 symbol / security id (ISIN) 40=2 order type: limit
44 limit price 59=0 time in force: day
34/52 sequence number, sending time 10 checksum
The broker responds with 35=8 ExecutionReport messages carrying an order status, cumulative quantity and average price — one per state change, from NEW through PARTIALLY_FILLED to FILLED, CANCELED or REJECTED. Two hard-won practices: the client order id must be unique per session and immutable, with amendments creating a new id linked to the original; and the sequence-number logic in the session layer is the mechanism that turns an unreliable connection into an ordered, gap-detectable stream, so never "fix" a sequence mismatch by resetting counters in production.
Regulation, reporting and correctness
Trading firms operate under reporting obligations that shape system design more than most engineers expect: transaction reports to the regulator with prescribed fields and deadlines, trade publication for transparency, records of orders and communications with defined retention, synchronised business clocks so that event ordering can be reconstructed, and controls around algorithmic trading such as kill switches and pre-trade limits.
The engineering implications are consistent regardless of jurisdiction. Every event needs an accurate, high-resolution timestamp from a disciplined clock source. Every message needs to be reproducible from an immutable log, because "what did the system see at 09:14:02" is a question you will be asked. State machines must be explicit, and reconciliation between front-office positions, back-office records and the custodian's statement must run daily and break loudly. In this domain a silent inconsistency is worse than an outage: an outage stops trading, whereas a wrong position keeps trading confidently.
Key takeaways
- The primary market creates instruments and the secondary market provides the liquidity that makes them worth creating.
- Equities, debt, funds and derivatives are four different contracts, and their lifecycle events — not their prices — drive the data model.
- Price-time priority in a limit order book is why queue position, and therefore latency, has monetary value.
- Novation to a central counterparty plus initial and variation margin replaces bilateral credit risk with collateralised exposure to a regulated institution.
- The move to T+1 removed the overnight buffer, making same-day allocation, confirmation and funding a hard requirement.
- Identify instruments and entities with ISIN, LEI and MIC rather than tickers, and treat reference data as versioned and effective-dated.
- FIX carries order flow with a session layer that guarantees ordering and gap detection; immutable client order ids and reproducible logs are non-negotiable.
Sources and further reading
Frequently asked questions
- Why does settlement take days when matching takes microseconds?
- Matching only agrees a price and quantity. Settlement moves the security and the cash between custody accounts at a central securities depository, which requires confirmation, allocation, netting, funding and delivery instructions from both sides. Compressing the cycle to one business day removed most of the slack, which is exactly why post-trade automation became urgent rather than optional.
- What does a central counterparty actually do?
- Through novation it replaces the original bilateral contract with two contracts, buyer to CCP and CCP to seller, so neither side carries the other's credit risk. In exchange the CCP nets exposures, demands initial and variation margin, and maintains a default fund. It concentrates risk deliberately in an institution built and regulated to manage it.
- Is FIX still relevant given modern binary protocols?
- Yes. FIX remains the common language for order flow between buy side, sell side and venues, and the community also publishes binary encodings and a session layer designed for low latency. Exchanges often expose a proprietary binary protocol on the hot path and FIX everywhere else, so most trading estates speak both.
- Is this guide investment advice?
- No. It is an educational explanation of how market infrastructure and trading systems work, written for engineers who build or operate them. Nothing here is a recommendation to buy, sell or hold any instrument, and none of it should be used to make investment decisions. For those, consult a suitably qualified and regulated professional.