Capital Markets Systems in C++ (OMS/EMS, FIX, Compliance & Settlement)
Learn how the software that runs the buy side and sell side actually works — by rebuilding it.
Learn how the software that runs the buy side and sell side actually works — by rebuilding it. This is the platform-engineering track for the systems every asset manager, hedge fund, and dealer depends on: the buy-side order-management platforms, the portfolio-and-risk platforms, the sell-side inventory platforms, and the cross-asset trade-and-risk platforms that run derivatives and post-trade. Those products are proprietary and license-gated, so you reconstruct the concepts they embody as small, correct, runnable C++ programs: a security master and the trade lifecycle, an order-management state machine, a hand-rolled FIX engine, a pre-trade compliance rule engine, execution algos and transaction-cost analysis, and allocation/clearing/settlement with an IBOR position keeper. Every project ties its code back to how the real platforms do the same job, so you build working knowledge of both the domain (how capital markets work front-to-back) and the systems (how the platforms are engineered). The track culminates in a multi-asset OMS/EMS simulator that runs an order from entry through a compliance gate, FIX routing, execution, allocation, and settlement while keeping a live position and P&L book. Built on the cpp-from-zero and dsa-cpp foundations, this track applies those foundations to the trading-platform and financial-technology engineering done on the buy side and sell side.
6 phases · 48 projects · v1.1.0
Target roles: Trading Systems Engineer (Buy-Side), OMS/EMS Platform Engineer, Buy-Side OMS/PMS Platform Engineer, FIX Connectivity Engineer, Sell-Side Trade-and-Risk Platform Engineer
Stack: C++17/20, g++/clang++, CMake, GoogleTest, FIX protocol
PHASE 1 · 8 projects
Capital Markets & the Trade Lifecycle
Build the domain vocabulary and data model as C++ types: securities and the instrument master, identifiers (ISIN/CUSIP/SEDOL/FIGI), asset classes, market participants, front/middle/back office, OMS vs EMS vs PMS vs IBOR/ABOR, the order-to-settlement lifecycle (T+1), and positions and P&L.
01 · featured
The Security Master
Build the reference-data spine every trading platform stands on: a Security record with an asset class, currency, lot size, and integer tick size, and a SecurityMaster over unordered_map with add, an std::optional lookup, and the order-admission gate that rejects any instrument not in the master.
C++20 · g++/clang++ · std::unordered_map · std::optional · int64_t integer money
02 · featured
Security Identifiers (ISIN/CUSIP/SEDOL/FIGI)
Implement real check-digit validation for CUSIP, ISIN, and SEDOL, build an ISIN from a country code and a CUSIP, describe the FIGI anatomy, and wire all of them into a security-master cross-reference (xref) that resolves one instrument from any of its identifiers.
C++17/20 · g++/clang++ · std::unordered_map · std::optional
03 · featured
Asset Classes & How They're Quoted
Model the five core asset classes (equity, fixed income, FX, futures, options) as C++ types and encode how each is quoted: a Treasury in 32nds vs yield with clean/dirty price, an FX pair with pips, a futures multiplier and tick value, and an option premium with a 100x multiplier — converting every quote to a dollar value with int64 money and a std::variant valuation engine.
C++17/20 · g++/clang++ · std::variant · integer arithmetic
04 · featured
Who's Who: Buy-Side, Sell-Side & the Plumbing
Model every market participant as a C++ type with a role and a fee schedule, then walk a single equity order from the buy-side PM's decision through the sell-side broker, the exchange, the clearinghouse, and the custodian — printing who touches the order, what they do, and what they charge, and computing the all-in cost in exact integer cents.
C++17/20 · g++/clang++ · integer arithmetic
05 · featured
Front, Middle & Back Office (OMS vs EMS vs PMS vs IBOR)
Model the three offices of an investment firm and the systems each owns — distinguishing PMS, OMS, EMS, IBOR, and ABOR — by routing one trade event front-to-back and showing why the IBOR and ABOR give two different position numbers at the same instant.
C++20 · g++/clang++ · integer arithmetic
06 · featured
The Trade Lifecycle, End to End
Model the full equity trade lifecycle as a validated state machine — ORDER, ROUTED, EXECUTED, ALLOCATED, CONFIRMED, CLEARED, SETTLED — with each stage attributed to its owning office and computed T+n business-day date, a block allocation split across accounts in integer cents, and rejection of illegal transitions like settling before clearing.
C++17/20 · g++/clang++ · integer arithmetic · business-day date math
07 · featured
Positions, Average Cost & P&L
Build a PositionKeeper that ingests a stream of fills across symbols and maintains net signed quantity, quantity-weighted average cost, realized P&L, and mark-to-market unrealized P&L — all in int64 cents, handling adds, reductions, and crossing through zero exactly to the cent.
C++17/20 · g++/clang++ · integer arithmetic
08 · featured
Portfolios, Holdings & NAV
Aggregate marked positions and a cash balance into a portfolio, strike its NAV, compute each holding's weight as a percentage of NAV with integer basis-point math, and print a full holdings appraisal report with market value, weight, and unrealized P&L — the top of the buy-side data model that ties Phase 1 together.
C++17/20 · g++/clang++ · integer arithmetic
PHASE 2 · 8 projects
Building an OMS (Buy-Side Core)
Engineer the core of an order-management system the way the leading buy-side order-management platforms do: order entry and validation, the order state machine and blotter, parent/child orders and slicing, cancel/replace, execution capture with the cum_qty/leaves_qty invariant, and multi-account orders.
01 · featured
Order Entry & Validation
Build the front door of an OMS: model an order as a C++ struct (ClOrdID, account, symbol, side, type, qty, limit price in int64 cents, TIF), load a security master, and run every order through a fail-fast validation gate that accepts or rejects it with a precise reason.
C++20 · g++/clang++ · integer (cents) money · STL containers
02 · featured
The Order State Machine
Model an order's lifecycle as a finite-state machine: the full FIX-style status alphabet, an explicit legal-transition table, a single transition function that rejects illegal moves (e.g. Filled to New), and a complete state-history audit trail.
C++20 · g++/clang++ · finite-state machine · STL containers
03 · featured
The Order Blotter
Build the live, queryable list at the heart of every OMS UI: store many stateful orders with their fill progress, derive filtered views (open / by account / by symbol) from one canonical store using composable predicates, and render them as an aligned trader-screen table.
C++20 · g++/clang++ · std::function · <iomanip>
04 · featured
Parent & Child Orders (Slicing)
Separate staged intent from working orders: stage a parent order, slice it into lot-aligned child orders by count or by size, keep parent and child linked both ways, and roll every child fill up so the parent's totals always equal the sum of its children.
C++20 · g++/clang++ · std::deque · integer (cents) money
05 · featured
Cancel/Replace & Amendments
Amend a working order's quantity and price the way FIX does: each cancel/replace mints a new ClOrdID linked to its predecessor via OrigClOrdID, fills carry forward across versions, and the chain enforces that only a working order can be amended and never below the already-filled quantity.
C++20 · g++/clang++ · FIX cancel/replace · integer (cents) money
06 · featured
Capturing Executions & Fills
Fold a stream of FIX-style execution reports into an order's running state: update cum_qty, leaves_qty, and a value-weighted avg_px in integer cents, derive PartiallyFilled/Filled from leaves, reject overfills, and assert cum_qty + leaves_qty == order_qty after every fill.
C++20 · g++/clang++ · FIX ExecutionReport · integer (cents) money
07 · featured
Block Orders Across Accounts
Model a block order that spans several accounts: attach a pre-trade allocation target per account, validate the targets sum to the block, work the block as a single unit, and split each fill across accounts pro-rata with integer largest-remainder math so every account is booked at the block's average price.
C++20 · g++/clang++ · largest-remainder apportionment · integer (cents) money
08 · featured
Assembling a Mini OMS
Integrate order entry and validation, the order state machine, the blotter, and execution capture into one buy-side OMS core, then run an order from entry through partial fills to Filled (and cancel another) with every status change routed through a single guarded transition.
C++20 · g++/clang++ · finite-state machine · integer (cents) money
PHASE 3 · 8 projects
FIX Protocol & Connectivity
Speak the language every OMS/EMS uses to reach brokers and venues: FIX message anatomy and checksums, parsing and building messages, the session layer (logon, heartbeat, sequence numbers, resend/gap-fill), NewOrderSingle/ExecutionReport/Cancel, and a working mini FIX engine.
01 · featured
Anatomy of a FIX Message
Build a program that constructs a real NewOrderSingle, prints it as it travels on the wire (SOH shown as '|'), and dissects every field into a labelled header/body/trailer table — internalizing the tag=value structure every OMS/EMS uses to reach brokers.
C++20 · g++/clang++ · FIX 4.2
02 · featured
Parsing FIX Messages
Build a parse() function that splits a raw SOH-delimited FIX string into an ordered field list plus a tag-to-value index, looks fields up by tag via std::optional, handles repeating fields, and pretty-prints the parsed message — the inverse of the builder and the foundation every later project queries.
C++20 · g++/clang++ · FIX 4.2
03 · featured
Building Messages: BodyLength & CheckSum
Build a build() function that assembles a complete FIX message field by field, computes BodyLength (tag 9) and CheckSum (tag 10) over the exact byte ranges the protocol specifies, and verifies the result by independently re-deriving both framing fields from the raw bytes.
C++20 · g++/clang++ · FIX 4.2
04 · featured
The Session Layer: Logon, Heartbeat, Logout
Build a stateful Session class that produces the core FIX admin messages — Logon(A), Heartbeat(0), TestRequest(1), Logout(5) — stamping SenderCompID/TargetCompID and a monotonic MsgSeqNum on every message, then simulate a full logon-to-logout session lifecycle between an initiator and an acceptor.
C++20 · g++/clang++ · FIX 4.2
05 · featured
Sequence Numbers, Gaps & Resend
Build a FIX receiver that enforces a monotonic MsgSeqNum, detects a gap when a message is dropped, buffers out-of-order messages, issues a ResendRequest(2) with BeginSeqNo/EndSeqNo, and recovers via either a PossDup resend of an application message or a SequenceReset(4) gap-fill for non-resendable admin traffic.
C++20 · g++/clang++ · FIX 4.2
06 · featured
NewOrderSingle (35=D)
Build a new_order_single() translator that turns a typed OMS Order object into a framed FIX NewOrderSingle, mapping Side/OrdType/TimeInForce enums to wire codes, emitting an int64-cents price as a correct FIX price string, and conditionally including Price (44) only for limit-style orders.
C++20 · g++/clang++ · FIX 4.2
07 · featured
ExecutionReport (35=8)
Build a consumer that parses a stream of FIX ExecutionReports, distinguishes ExecType from OrdStatus, and folds the per-fill LastQty/LastPx into the order's running CumQty, LeavesQty, and volume-weighted AvgPx — verifying the CumQty+LeavesQty==OrderQty invariant and cross-checking against the broker's reported totals.
C++20 · g++/clang++ · FIX 4.2
08 · featured
A Mini FIX Engine
Combine the parser, builder, session, and application messages from the whole phase into an Engine/Broker pair that logs on, sends a NewOrderSingle, processes ExecutionReports, cancels the remainder with an OrderCancelRequest(35=F), and maintains independent monotonic sequence numbers — reconstructing the order's final filled/canceled state from the wire.
C++20 · g++/clang++ · FIX 4.2
PHASE 4 · 8 projects
Pre-Trade Compliance & Risk
Build the differentiator of the leading buy-side platforms: a pre-trade compliance rule engine (mandates/guidelines, restricted lists, concentration and exposure limits, buying power), pre- vs post-trade evaluation, a small rules DSL, and core risk metrics (exposure, VaR concept, Greeks, margin).
01 · featured
What Compliance Checks & Why
Build the vocabulary of investment compliance: mandates/guidelines and their sources (UCITS, 40-Act, client IMA), the pre-trade vs at-trade vs post-trade distinction, and a pure (Order, Portfolio, Guideline) -> Decision check that evaluates the hypothetical post-trade book and blocks an order before it is sent.
C++20 · g++/clang++ · integer money (int64 cents)
02 · featured
Restricted & Prohibited Lists
Build a fail-closed hard-block screen that resolves an order through a security master to its issuer and country of risk, then matches it against restricted-security, restricted-issuer, sanctioned-country, and wildcard lists — blocking an issuer's bonds and ADRs via look-through, not just its stock, and rejecting any unknown security.
C++20 · g++/clang++ · std::optional · unordered_set/map
03 · featured
Concentration Limits
Build a concentration check that applies an order to a hypothetical post-trade book, aggregates market value by issuer and by sector, and enforces the UCITS 5/10/40 rule plus a sector cap — computing every weight as a double from int64 cents and reporting all breaches an order would cause.
C++20 · g++/clang++ · integer money (int64 cents) · std::map
04 · featured
Exposure & Issuer Limits
Value a long/short book in signed market value, compute gross vs net exposure, aggregate an issuer's stock and bonds into a single look-through exposure, and enforce a per-issuer gross cap plus a portfolio gross-leverage limit pre-trade — including the case where a buy that covers a short reduces gross exposure.
C++20 · g++/clang++ · integer money (int64 cents) · std::llabs
05 · featured
Buying Power & Position Limits
Build the account-protection gate: compute buying power from cash and a Reg T margin requirement, check an order's total cost (notional plus fees) against it, enforce per-name share and notional position limits on the post-trade position, and block a sell that would open an impermissible short.
C++20 · g++/clang++ · integer money (int64 cents) · std::map
06 · featured
A Pre-Trade Compliance Rule Engine
Build the buy-side compliance-engine pattern: model each rule as a std::function<RuleResult(const Order&, const Portfolio&)> with id and severity, hold them in a registry, and write a generic engine that folds every rule's pass/warn/fail into one cited compliance report — so a new rule is a push_back, not an engine change.
C++20 · g++/clang++ · std::function · registry / strategy pattern
07 · featured
Risk Metrics: Exposure, Beta, VaR
Build the risk dashboard a PM watches: mark a long/short book to market in int64 cents, compute net/gross and beta-adjusted exposure and portfolio beta, then estimate one-day Value-at-Risk two ways — parametric (z x sigma x exposure) and historical (empirical quantile of a P&L series) — keeping money exact and analytics in double.
C++20 · g++/clang++ · integer money + double analytics · <cmath>/<algorithm>
08 · featured
Derivatives Risk: Greeks & Margin
Price a European option with Black-Scholes, compute its delta/gamma/vega/theta, convert the position to a delta-equivalent stock exposure, compute a scenario-based initial margin, and build a pre-trade risk gate that blocks an option order if it breaches a portfolio delta limit or requires more margin than account equity.
C++20 · g++/clang++ · Black-Scholes / <cmath> · double analytics + int64 money
PHASE 5 · 8 projects
EMS, Execution Algos & Market Data
Engineer the execution side that the vendor execution-management systems and the portfolio platforms' trading modules occupy: EMS vs OMS, deterministic TWAP/VWAP algos, smart order routing across venues, market-data snapshots (BBO/depth), average-price fill aggregation, and transaction-cost analysis for best execution.
01 · featured
EMS vs OMS — Working an Order
Model the OMS→EMS handoff in C++: a StagedOrder (the PM's intent) becomes a WorkingOrder that adds an execution algo, a live BBO snapshot, and child-order slices across venues, driven STAGED→WORKING→DONE while maintaining cum_qty + leaves_qty == target_qty.
C++20 · g++/clang++ · integer arithmetic
02 · featured
Consuming Market Data (BBO & Depth)
Model a BBO and L2 depth book in integer ticks, compute mid/spread/microprice and order-book imbalance, walk the depth ladder to price an N-share sweep, and feed the microprice signal into a cross-now-vs-post-passively execution decision.
C++20 · g++/clang++ · integer arithmetic
03 · featured
The TWAP Algo
Build a deterministic TWAP execution algo: slice a parent order into N equal time buckets (remainder front-loaded), emit a child per bucket along a price path, and show that equal slices make the achieved average price equal the time-weighted benchmark, then report slippage vs benchmark and vs arrival in basis points.
C++20 · g++/clang++ · integer arithmetic
04 · featured
The VWAP Algo
Build a deterministic VWAP execution algo: slice a parent order in proportion to a U-shaped intraday volume profile using the integer largest-remainder method, emit volume-weighted children, and show the achieved average price tracks the interval VWAP benchmark, with slippage vs VWAP and arrival in basis points.
C++20 · g++/clang++ · integer arithmetic
05 · featured
Smart Order Routing
Build a smart order router over a fragmented market: model venues with price, size, and fee, compute each venue's effective price (ask + fee/rebate), rank by it with a stable sort, sweep cheapest-first respecting venue size, and report the routing plan plus the blended quoted and effective price.
C++20 · g++/clang++ · integer arithmetic
06 · featured
Aggregating Fills & Average Price
Aggregate a stream of fills from multiple venues and slices into a cumulative quantity and size-weighted average price in int64 cents, maintain the running average and leaves invariant, break results down per venue with std::map, and measure slippage vs the arrival price in basis points from the exact integer notional.
C++20 · g++/clang++ · integer arithmetic
07 · featured
Transaction Cost Analysis (TCA)
Build a TCA report from the four price marks of an order's life (decision, arrival, execution average, end): benchmark against arrival and interval VWAP, compute implementation shortfall and decompose it into delay, trading, and opportunity cost in int64 cents and basis points, and explain best execution.
C++20 · g++/clang++ · integer arithmetic
08 · featured
A Best-Execution Report
Integrate VWAP slicing, smart order routing, fill aggregation, and TCA into one end-to-end pipeline: take a worked parent order, slice it by volume, route each slice across venues, aggregate the fills into a per-venue and overall average price, and decompose the cost into an implementation-shortfall best-execution report.
C++20 · g++/clang++ · integer arithmetic
PHASE 6 · 8 projects
Post-Trade, Allocations, Settlement & Sell-Side
Complete the lifecycle the way the sell-side and cross-asset trade-and-risk platforms do the back office: block allocation (pro-rata and average price), confirmation/affirmation, clearing and settlement (T+1, DvP), trade matching and reconciliation, sell-side inventory and market making, and the derivatives lifecycle with an IBOR position keeper.
01 · featured
Allocating a Block Fill (Pro-Rata)
Split one block execution across client accounts pro-rata to their order size, handling indivisible-share residuals with the largest-remainder method so the parts sum to the block exactly and the booked cash reconciles to the penny — the post-execution allocation step the buy-side OMS platforms perform every day.
C++20 · g++/clang++ · integer arithmetic
02 · featured
Average Price Allocation
When a block fills at several prices, compute the size-weighted average price in integer cents, book every account at that single fair price, and allocate the exact executed notional with the largest-remainder method so the cash reconciles to the penny despite the average being a sub-cent value.
C++20 · g++/clang++ · integer arithmetic
03 · featured
Confirmation & Affirmation
Build the post-trade match: hold your firm's record of a trade, compare it field-by-field against the broker's confirmation, affirm when the economics agree, and detect a price/quantity/settlement-date break with a precise report — the gate every institutional trade passes before it can settle.
C++20 · g++/clang++ · integer arithmetic
04 · featured
Clearing & Settlement (T+1, DvP)
Compute settlement dates as T+1 business days with a weekend-skipping counter, net affirmed trades into a per-day settlement ladder of securities-versus-cash obligations, and model Delivery-versus-Payment, the CCP/custodian roles, and Standing Settlement Instructions — the back-office settlement workflow the CSD and the buy-side platforms automate.
C++20 · g++/clang++ · integer arithmetic
05 · featured
Matching & Reconciliation
Reconcile your internal trade book against the custodian/broker statement: match records on a shared key, classify every pairing as matched, missing-internal, missing-external, quantity mismatch, or price mismatch, and produce a reconciliation report with per-break detail and a summary by type.
C++20 · g++/clang++ · std::map
06 · featured
Sell-Side Inventory & Market Making
Take the dealer's seat: maintain a signed inventory position with weighted-average cost as client trades fill, realize P&L on offsets and mark the open position to market, derive the desk's axe, and post a two-way quote skewed toward it — the inventory, axe, and P&L model at the heart of the sell-side OMS.
C++20 · g++/clang++ · integer arithmetic
07 · featured
The Derivatives Lifecycle
Build a lifecycle engine for a vanilla fixed-for-floating interest-rate swap: capture the trade, advance it period by period through reset and coupon events computing net cashflows in integer basis points and cents, and revalue the remaining swap to see whether receiving fixed is in- or out-of-the-money — the capture-schedule-process-revalue skeleton of the cross-asset trade-and-risk platforms.
C++20 · g++/clang++ · integer arithmetic
08 · featured
The IBOR: Investment Book of Record
Build the firm's real-time book of record: seed positions and cash at start of day, then update intraday from execution fills and derivative lifecycle events (a bond coupon) in one consistent structure, and mark to market for a live total value — the position-keeping core that the buy-side platforms put at the center of the platform, and the spine that ties the whole track together.
C++20 · g++/clang++ · std::map
Next step
Request Capital Markets Systems in C++ (OMS/EMS, FIX, Compliance & Settlement)
An advisor reviews the fit and confirms terms in writing. A request is not an acceptance and nothing is charged until you agree.
