Leanpub Header

Skip to main content

The Production Trading Systems Library

Eleven books. One complete trading stack in modern C++.

From kernel bypass to the matching engine, from nanosecond timestamps to deterministic backtests, build every layer of a production trading system the way it actually runs: measured, replayed, and proven.

Nothing is true until it has been profiled, fuzzed, and replayed.

Bought separately

$569.94

Minimum price

$199

$299

You pay

Author earns

$

Also available for 6 book credits with a Reader Membership

These books have a total suggested price of $569.94. Get them now for only $199!
About

About

About the Bundle

Most C++ books stop where production starts. They show you a lock-free queue that works on a laptop, an order book that handles a hundred orders, and a benchmark that measures an empty loop. Then you put it in front of real market data and it falls apart.

This library starts where those books stop.

Eleven books take you through every layer of a production trading system, in the order you would actually build one. No toy examples, no hand-waving, and no technique without the measurement that proves it works.

WHAT YOU WILL BUILD

  1. Architecting HFT Systems in Modern C++ The full map: kernel bypass, lock-free pipelines, and a tick-to-trade path where every nanosecond is accounted for.
  2. C++ Data-Oriented Design Cache-line mechanics, struct-of-arrays layouts, and memory access patterns that decide performance before a single instruction runs.
  3. Vectorized C++ SIMD from intrinsics to std::simd, and the data layouts that let the hardware do eight things at once.
  4. Precision Time for Trading Systems in C++ PTP, hardware timestamping, and clock synchronization, because you cannot optimize a nanosecond you cannot measure.
  5. Bare-Metal Market Data Engines in C++ Zero-copy feed parsing, sequence gap recovery, and order book reconstruction that stays byte-identical to the exchange.
  6. Deterministic Matching Engines in C++ Lock-free order books, cache-aligned price-time priority, and trade execution with zero jitter.
  7. Deterministic Pricing Engines in C++ Monte Carlo, finite difference solvers, and real-time Greeks that return bit-identical results at any thread count.
  8. Deterministic Risk Engines in C++ Lock-free VaR, real-time stress testing, and position tracking that enforces limits without slowing the hot path.
  9. Low-Latency Execution Algorithms in C++ Smart order routing, TWAP and VWAP scheduling, and queue-aware placement that works orders without leaking intent.
  10. Deterministic Backtesting Engines in C++ Event-driven simulation and realistic fill modeling, with lookahead bias made impossible by construction.
  11. Ultra-Low-Latency C++ Trading Systems The capstone. Matching, risk, and execution integrated into a single deterministic pipeline.

WHY THIS LIBRARY IS DIFFERENT

Every book follows one rule: nothing is true until it has been profiled, fuzzed, and replayed.

Every technique comes with three things: the measurement that proves it, the trade-off it costs, and the failure it prevents.

Every chapter closes with a running ledger, a concrete record of latency, throughput, and correctness at that stage of the build. By the final chapter, you have a complete performance history of the system you built, not a pile of disconnected snippets.

Every example is modern C++20/23 code that compiles, handles the failures real systems hit, and states the memory ordering, data layout, and compiler flags it depends on.

WHO THIS IS FOR

C++ engineers moving into trading, market making, or exchange technology. Quant developers who want infrastructure skills that hold up in production. Systems engineers who want the most demanding low-latency workloads in the industry as their training ground. Anyone who has shipped “fast” C++ and then watched it miss its latency target under real load.

You should be comfortable with modern C++ and Linux. Trading knowledge is not required; every market concept is introduced where the system first needs it.

WHAT YOU GET

All 11 books in PDF and EPUB, DRM-free. Every future update to every book, at no extra cost. A complete reading path, from architecture to capstone. The full library at a fraction of the individual price.

Start with the map. Build the foundations. Construct every engine. Finish with a system you understand down to the nanosecond.

Books

About the Books

Low-Latency Execution  Algorithms in C++

Low-Latency Execution Algorithms in C++

Smart Order Routing, TWAP/VWAP Scheduling and Queue-Aware Order Placement.

Most of a strategy’s edge is won or lost after the decision to trade. A VWAP algorithm chases a volume spike at the close and pays the spread on its last third. A router loses queue priority on every passive child because its replace logic treats a size reduction as a new order. Identically sized slices arriving every thirty seconds teach the market your rhythm long before the order finishes. None of these show up as errors. They show up weeks later in the markouts.

This book is a production engineer’s guide to the layer between a trading decision and a filled order. It shows you how to build a complete execution engine in modern C++20/23, one that controls cost, latency and information leakage, and can explain every decision it makes.

You will learn how to:

  • Measure execution honestly, with implementation shortfall from the decision price, VWAP excluding your own fills, pre-trade cost models, live slippage tracking and post-trade TCA with real statistical bounds
  • Build TWAP, VWAP, percentage-of-volume and adaptive implementation shortfall schedules, including Almgren-Chriss trajectories set from a stated half-life rather than a raw risk-aversion number
  • Estimate queue position from market data and make the passive-versus-aggressive decision in tens of nanoseconds
  • Preserve queue priority with correct cancel/replace policies, and limit information leakage with randomization, price bands and footprint caps
  • Route across a consolidated multi-venue book by net price, hit rate and fees, and align arrival times across venues so slower venues don’t fade
  • Score dark pools and venues by markouts rather than fill rates, and detect hidden liquidity
  • Engineer the hot path with single-writer order state, lock-free queues, hierarchical timer wheels, allocation-free logic and pre-trade risk gates that add no meaningful latency
  • Validate everything with queue-aware replay, adversarial fault scenarios, live A/B testing and TCA regression suites between releases
  • Run it in production with per-dimension monitoring, latched kill switches, tamper-evident audit trails and staged rollout

Every chapter pairs its concepts with compilable code that handles the failures live systems actually hit: rejects, unsolicited cancels, fills that arrive after a cancel, venue disconnects mid-sweep, halts and stale data. Every chapter also closes with a Slippage and Latency Ledger, which tracks decision-to-wire latency and execution cost side by side as the engine is built.

Four appendices serve as working references:

  • order types and venue rules
  • execution cost and impact formulas
  • TCA metric definitions
  • an algorithm validation checklist

This book is written for C++ engineers and quants building or running execution infrastructure. It assumes working knowledge of modern C++ and concurrency, and introduces the financial models where the engine first needs them.

Deterministic Pricing Engines in C++

Deterministic Pricing Engines in C++

Monte Carlo Simulation, Finite Difference Solvers and Real-Time Greeks for Production Trading Systems

Two servers price the same portfolio from the same market snapshot with the same binary, and their deltas disagree in the eleventh digit. Nobody changed the model. A reduction order moved with the thread scheduler, or a compiler fused one multiply-add on one build and not the other. Risk reconciliation stops, and someone spends three days proving the numbers were “basically the same”.

This book shows you how to build pricing engines that cannot have that problem.

Deterministic Pricing Engines in C++ builds one production-grade engine from the floor up: closed-form kernels, trees, finite difference solvers, Monte Carlo, stochastic and local volatility, calibration, and adjoint Greeks. Every layer holds to one standard: the same inputs, method and build give the same bits, on any host and at any degree of parallelism. Then the book shows why that standard is what makes aggressive optimization safe. Caching, vectorization, scenario batching and incremental repricing all become changes you can prove harmless before they merge.

You will learn to:

  • Pin the floating-point behaviour that silently changes prices: FMA contraction, fast-math, FTZ/DAZ and libm drift.
  • Write branchless, vectorized Black-76 kernels with single-pass analytic Greeks that price full option chains in low single-digit microseconds.
  • Build implied volatility solvers that converge in bounded iterations and return typed errors instead of garbage.
  • Construct arbitrage-free SVI surfaces, bootstrapped curves and dividend-aware forwards, and swap them lock-free under live updates.
  • Run Monte Carlo on counter-based Philox streams and Sobol sequences with Brownian bridges, with results that do not change when you move from 16 cores to 64.
  • Apply antithetics, control variates, importance sampling and Longstaff-Schwartz correctly, including the conditions under which each one makes things worse.
  • Solve the pricing PDE with Crank-Nicolson, Rannacher smoothing and penalty-method American exercise.
  • Price Heston with the COS method, build Dupire local volatility from a live surface, and calibrate with Levenberg-Marquardt in bounded time.
  • Compute every bucketed Greek for a small multiple of one price using pathwise estimators and expression-template AAD.
  • Serve prices to strategy and risk through seqlocks and lock-free rings, with content-addressed caching and shadow deployment.

What makes this book different:

  • Every chapter opens with a real class of production failure, not a definition.
  • Equations come first, then the code that implements them, with every place the discrete version departs from the mathematics called out.
  • The code is modern C++23 (concepts, std::expected, designated initializers, C++20 atomics) and is written to compile, not as pseudocode.
  • Every chapter ends with a Determinism Ledger: a running record of the guarantees the engine has gained so far.
  • Appendices include a full formula and Greeks reference, convergence tables, market data conventions, and a release-gate validation checklist you can adopt as is.

Who it’s for: quant developers, trading-systems engineers and engineering leads who own pricing infrastructure in production. It assumes you know what a Greek is and are comfortable with modern C++. It does not teach either from scratch.

Architecting High Frequency Trading Systems

Architecting High Frequency Trading Systems

Modern C++ design patterns for Lock-Free Pipelines, Kernel Bypass, and Nanosecond Execution.

In the world of High-Frequency Trading, nanoseconds separate the profitable from the obsolete. Which side of the trade are you on?

Standard C++ practices and traditional operating system architectures are not fast enough for modern financial markets. Every cache miss, context switch, and kernel interrupt adds latency that degrades trading performance. To compete at the highest level, you must strip away the abstractions and engineer your system to work in perfect harmony with the bare metal.

Architecting HFT Systems in Modern C++ is a definitive, hands-on guide to building ultra-low-latency trading infrastructure. This book bridges the gap between theoretical computer science and the brutal realities of production trading systems. You will learn how to bypass the kernel entirely, design lock-free memory structures, and write code that executes consistently in under a microsecond.

Whether you are a quantitative developer, a systems architect, or a senior C++ engineer looking to enter the algorithmic trading industry, this book provides the exact blueprints used by top-tier proprietary trading firms.

What You Will Learn Inside:

  • The Machine and The Backbone: Master CPU topology, NUMA architecture, and core isolation. Build custom monotonic arena allocators and replace standard memory management to completely eliminate allocation delays in the hot path.
  • Lock-Free Concurrency: Construct Single-Producer, Single-Consumer (SPSC) ring buffers from first principles. Understand acquire/release semantics and memory ordering to handle backpressure without ever blocking.
  • Kernel Bypass Networking: Implement DPDK and io_uring to process data precisely where Direct Memory Access (DMA) places it, achieving zero-copy packet reception and transmission.
  • Wire-Speed Ingestion: Decode complex binary protocols (FIX/FAST, ITCH, OUCH) using template-driven deserialization, branchless field extraction, and SIMD instructions.
  • Zero-Allocation Order Books: Design price-level structures that fit entirely within L1 cache and update in under 50 nanoseconds.
  • The Decision and Execution Layer: Build a zero-virtual-call callback architecture for trading strategies, implement hardware-efficient risk gates, and manage order lifecycles with compile-time validation.
  • Deterministic Simulation and Testing: Ensure absolute reliability through full-pipeline PCAP replay, bit-reproducible runs, and memory-mapped asynchronous logging.

You cannot afford to rely on generic software design patterns when money is on the line. Stop losing trades to system overhead.

Get your copy today and learn how to engineer systems that execute faster than the competition.

C++ Data-Oriented Design

C++ Data-Oriented Design

Cache-Line Mechanics, SoA Layouts, SIMD Vectorization, and Memory Access Optimization for High-Performance Systems

Learn to eliminate cache miss bottlenecks and memory stall penalties with confidence using measured, verified data layout engineering, guided by a systems programmer’s playbook for struct design, access pattern optimization, and concurrent data structure architecture across CPU-bound production systems.

Key Features

  • Master core data-oriented design disciplines used across real production systems, from cache line mechanics and struct field ordering through ECS component pools, flat trees, and lock-free pipelines
  • Learn to eliminate hidden performance losses including pointer chasing, heap fragmentation, false sharing, strided access patterns, and object-oriented drift that silently undoes optimization work
  • Build provable throughput without assuming it, using perf, Cachegrind, Intel VTune, and a Google Benchmark CI pipeline with baseline comparison and static layout assertions

Book Description

Most engineers reach for algorithmic optimizations when their code is slow, unaware that the same pointer-connected heap layout or the same AoS struct that looked fine in testing will stall the CPU on memory the day the working set actually grows. This book closes that gap, providing the practical knowledge of cache line mechanics, data layout transformation, and concurrent system design needed to build software with measured throughput guarantees, not assumed ones.

You will begin at the silicon level, understanding what cache lines physically are, how the memory hierarchy imposes latency on every access that misses it, and why the pointer-connected layouts that object-oriented design naturally produces are structurally hostile to the hardware. You will measure the problem before touching a single struct, using hardware performance counters to quantify cache miss rates, memory stall fractions, and instructions per cycle across your real hot paths.

The book walks through the full arc of production data-oriented engineering: struct field ordering and padding elimination, hot and cold data separation, Array of Structures to Structure of Arrays conversion that unlocks compiler auto-vectorization, AoSoA hybrid layouts, Entity Component Systems with dense archetypal storage and generational handles, flat array replacements for pointer-based trees and lists, slot maps that provide O(1) stable-handle lookup without pointer indirection, software prefetching, cache tiling, false sharing elimination, per-thread work partitioning, and lock-free ring buffer design where memory layout determines coherence traffic as much as the algorithm does. Three applied chapters walk a scene graph, a high-frequency trading order book, and a particle system through complete transformations with hardware counter measurements at every step.

Whether you are optimizing your first cache-bound simulation loop or hardening a production system that must sustain low latency under real concurrent load, this book provides actionable layout techniques and measurement discipline for performance that holds under live workloads.

What You Will Learn

  • Define pointer chasing, false sharing, and strided access precisely and distinguish them from ordinary performance noise
  • Build real SoA layouts and ECS component pools without relying on assumed-efficient object-oriented patterns
  • Deconstruct cache miss overhead into working set, access pattern, and allocation-driven components
  • Evaluate AoS, SoA, and AoSoA layouts per workload before committing to a storage design
  • Verify layout correctness against hardware counters and benchmark baselines before trusting a result
  • Recognize and eliminate silent working set inflation without guessing at root cause
  • Know when a data structure is provably cache-friendly versus merely contiguous
  • Design per-thread partitioning and lock-free pipelines for bursty, contention-prone concurrent workloads

Who This Book Is For

This book is for C++ systems engineers, performance engineers, and senior developers building or optimizing throughput-critical software across game engines, simulation systems, financial infrastructure, and any domain where the gap between theoretical hardware throughput and measured application performance demands a hardware-level explanation. No prior knowledge of data-oriented design or CPU microarchitecture is assumed.

Table of Contents

  • The Hardware Reality: Why Object-Oriented Layout Betrays the CPU
  • Data Layout Fundamentals
  • Structure of Arrays versus Array of Structures
  • Entity Component Systems and Data-Driven Architecture
  • SIMD and Vectorization Through Layout
  • Flat Data Structures and Pointer Elimination
  • Memory Access Patterns and Prefetching
  • Data-Oriented Design for Concurrent Systems
  • Applying Data-Oriented Design to Real Systems
  • Profiling, Validation, and Sustaining Data-Oriented Codebases; Appendices
Deterministic Matching Engines in C++23/26

Deterministic Matching Engines in C++23/26

Lock-Free Order Books, Cache-Line Aligned Price-Time Priority, and Zero-Jitter Trade Execution.

Stop treating a matching engine's correctness as something a demo can prove. Learn to build lock-free order books, cache-line aligned price-time priority, and zero-jitter trade execution, guided by a verification discipline that takes the system from a passing test suite to a build you can prove holds under real concurrency, real load, and a real crash.

Key Features

  • Learn the precise, falsifiable definition of determinism and build order book data structures, matching semantics, and price-time priority guarantees that hold under real order flow rather than only under a synthetic benchmark
  • Engineer out non-determinism directly with lock-free CAS loops, hazard-pointer-safe memory reclamation, cache-line alignment verified against real perf c2c measurements, zero-allocation memory pools, and full OS-level jitter elimination
  • Take the engine from a correctness baseline to a field-tested, recoverable production system with adversarial fuzzing, ten-thousand-run deterministic replay, fault-injected crash recovery, and a full annotated reference implementation

Book Description

A matching engine that never crashes in testing is not a matching engine that behaves correctly under real order flow, and the gap between those two claims is not a corner case, it is where production trading systems actually fail. This book treats that gap as the engineering problem it actually is, starting with the honest question of what "deterministic" precisely guarantees and what it does not, before a single line of optimization code gets written.

From there it covers the full stack in order: order book data structures benchmarked under real volume, order types and matching semantics including icebergs, stop-cascades, and amendment priority rules, and price-time priority as a fairness guarantee that individually correct features can still violate the moment they interact, illustrated by a full regulatory-inquiry case study. The engineering chapters that follow eliminate non-determinism at its source, lock-free compare-and-swap design, the ABA problem and hazard pointers, cache-line alignment measured rather than assumed, zero-allocation hot paths backed by pooled memory, and the nine sources of OS and scheduler jitter most engineers building their first low-latency system never think to check.

The final part closes the loop: measuring tail latency honestly with HDR histograms and realistic burst-load generation instead of misleading averages, proving correctness with libFuzzer-driven edge-case discovery and property-based testing, confirming determinism with byte-identical replay across ten thousand adversarially-scheduled runs, and validating crash recovery with fault injection and measured recovery-time objectives, so that every guarantee this book opens with still holds on the other side of a real production incident.

What You Will Learn

  • Define determinism precisely and distinguish it from thread safety, fairness, and low latency
  • Choose and benchmark order book data structures against real, not synthetic, order flow shapes
  • Implement lock-free CAS loops and hazard-pointer-based memory reclamation correctly
  • Diagnose and eliminate false sharing using perf c2c instead of assumed struct padding
  • Build zero-allocation hot paths with pooled memory verified through allocator instrumentation
  • Eliminate OS and scheduler jitter with core pinning, SCHED_FIFO, NUMA placement, and interrupt isolation
  • Measure tail latency correctly using HDR histograms and realistic, burst-shaped load generation
  • Prove correctness with property-based testing, coverage-guided fuzzing, and deterministic replay
  • Design and test crash recovery without silently breaking price-time priority guarantees

Who This Book Is For

This book is for C++ systems engineers, quantitative developers, and trading infrastructure teams building matching engines, order management systems, or any latency-sensitive concurrent system where correctness under load is non-negotiable. Familiarity with modern C++, concurrency fundamentals, and Linux systems programming is assumed; prior exposure to lock-free data structures is helpful but not required.

Table of Contents

  1. The Anatomy of a Production Failure
  2. Order Book Data Structures Under Real Volume
  3. Order Types and Matching Semantics
  4. Price-Time Priority and Fairness Guarantees
  5. Lock-Free Design with Compare-and-Swap
  6. Cache-Line Alignment and False Sharing
  7. Memory Pools and Zero-Allocation Hot Paths
  8. Eliminating OS and Runtime Jitter
  9. Measuring Tail Latency, Not Averages
  10. Deterministic Replay and Property-Based Testing
  11. Fault Recovery Without Losing Determinism; Appendices; Conclusion
Deterministic Backtesting Engines in C++

Deterministic Backtesting Engines in C++

​Event-Driven Simulation, Exchange Replay and Realistic Fill Modeling Without Lookahead Bias.

Your backtest says Sharpe 4. The market says otherwise.

Most strategies don’t fail because the idea was wrong. They fail because the backtest was lying, and nobody built an engine capable of catching it. A fill that could never have happened. A price the strategy saw before it existed. A latency the simulator pretended away. A sweep of four thousand configurations that found exactly what noise finds.

Deterministic Backtesting Engines in C++ shows you how to build the engine that catches all of it. This is not a book of strategies. It is a book about the machinery that decides whether a strategy’s numbers can be believed. You will build a production-grade, event-driven backtester in modern C++ that treats every result as a claim and tries to break it, then shows you exactly how much of that result rests on assumptions.

Key Features

  • Build a fully deterministic engine: same inputs, same outputs, bit for bit, across runs, machines, and thread counts
  • Make lookahead bias impossible by construction, with a point-in-time data API the compiler enforces
  • Reconstruct full order books from ITCH-style feeds and validate them against exchange snapshots
  • Model queue position, partial fills, cancel races, hidden liquidity, and icebergs with every assumption stated
  • Simulate latency as four separate delays, built from production measurements, including the tails that hit at the open
  • Run one strategy codebase in both backtest and live trading, proven identical by parity testing
  • Scale to terabytes of tick data with memory-mapped pipelines and deterministic parallel sweeps
  • Every chapter ends with a Fidelity and Throughput Ledger: what it costs, what it is checked against, and how determinism is proven

What You Will Learn

  • Why backtests lie, and the fingerprint each leak leaves in the trade log
  • Virtual clocks, allocation-free event dispatch, and deterministic tie-breaking for simultaneous events
  • Columnar, memory-mapped tick storage, survivorship-free universes, and point-in-time corporate actions
  • Price-time matching against recorded liquidity, with honest depletion and level walking
  • Fill probability, slippage, temporary and permanent market impact, fees, rebates, and venue rules
  • Latency sensitivity analysis: how much of your edge survives each added microsecond
  • CRTP and zero-virtual-call strategy harnesses, state isolation, and multi-strategy simulation
  • Integer-exact accounting, mark-to-market rules, margin, and reconciliation against exchange fill reports
  • Walk-forward testing, the deflated Sharpe ratio, block bootstrap resampling, and capacity estimation
  • Reproducibility manifests, regression suites, sim-to-live parity, and CI for a backtesting platform

Who This Book Is For

Quantitative developers, quant researchers, and trading infrastructure engineers who build or depend on backtesting systems for intraday strategies: market making, short-horizon signals, and execution. You should be comfortable with modern C++ (templates, concepts, the memory model) and know what an order book is. Everything else is built from the ground up in C++23, with complete listings that compile as shown.

What You Get

  • 12 chapters across 5 parts, from foundations to production deployment
  • 4 appendices: data formats, model parameters, statistical formulas, and a 60-point backtest validation checklist
  • A complete reference architecture with CMake build, project layout, and tests

Part of Weston Ashgrove’s Field Guide to Production Trading Systems, alongside Deterministic Matching Engines, Deterministic Risk Engines, and Deterministic Pricing Engines.

A backtest is a claim. This book gives you the engine to test it.

Precision Time for Trading Systems in C++

Precision Time for Trading Systems in C++

PTP, Hardware Timestamping and Clock Synchronization for Nanosecond Event Ordering.

Your timestamps are lying to your P&L.

Every number your desk trusts rests on a clock. That includes your markouts, your tick-to-trade, your fill attribution, and the replays you backtest against. When those clocks disagree by a few microseconds, the numbers don’t fail loudly. They drift quietly. A fill gets booked against the wrong book state, a strategy’s edge looks like latency, and a backtest built from captured data rewards behaviour that live trading punishes.

Most firms find out the hard way: in a fill dispute, a post-trade investigation that can’t sequence its own events, or a regulator asking for evidence nobody kept.

This book is the fix, written for people who already know why a microsecond matters.

What you get:

  • Defensible event ordering across hosts and venues. You’ll know which came first, and when the clocks can’t tell you, you’ll know that too.
  • Latency attribution you can trust. Separate wire, kernel, application and venue time, with an honest uncertainty bound on every interval.
  • Clean capture and replay. Hardware timestamps on every packet, so your research data matches what your strategies actually saw.
  • A timing chain that fails safe. PTP, boundary clocks, GNSS holdover and failover, plus monitoring that downgrades bad timestamps before they reach your analysis.
  • Audit-grade evidence. Tamper-evident, per-minute proof that your clocks met their limits during any window anyone asks about.
  • Production C++20/23 throughout. Zero-overhead TSC timestamping, division-free nanosecond conversion, uncertainty-aware stream merging, and hybrid logical clocks. You also get complete linuxptp and chrony configurations ready to deploy.

Who it’s for: senior quants, trading-systems leads, and low-latency engineers who make decisions on the numbers their timestamps produce.

No theory padding and no vendor pitch, just the mechanisms, the failure modes and the code.

If your edge is measured in microseconds, your clocks are part of your strategy. Get them right.

Bare-Metal Market Data Engines in C++

Bare-Metal Market Data Engines in C++

Zero-Copy FIX/ITCH/OUCH Parsing, Sequence Gap Recovery, and Deterministic Order Book Reconstruction.

Learn to eliminate silent feed corruption with confidence using measured, verified engineering, guided by a pragmatic architect's playbook for zero-copy parsing, gap recovery, and deterministic reconstruction.

Key Features

  • Master core reliability disciplines used across real production feed handlers, from parsing correctness to fault recovery
  • Learn to eliminate silent corruption, including sequence gaps, reordering, dual-feed divergence, and clock-domain errors
  • Build provable determinism without assuming correctness, using allocation counts, byte-identical replay, and reconciliation

Book Description

Most engineers ship a feed handler once it parses cleanly, unaware the test stream never exercised a real gap. This book closes that gap, providing the practical knowledge of zero-copy parsing, gap recovery, and reconstruction needed to build a handler with measured correctness, not assumed correctness.

You will begin by parsing FIX, ITCH, and OUCH at speed, benchmarking against real message-mix captures, and detecting sequence gaps that distinguish true loss from ordinary reordering. You'll gain a clear framework for engineering out silent corruption at its source, understanding where naive parsing, unbounded buffers, and untested recovery introduce risk, and how each cost compounds, or gets eliminated, under real load.

The book walks through the full arc of a production system: snapshot-plus-incremental recovery that survives a real outage, order book reconstruction with correctly scoped liquidity, measuring wire-to-book latency honestly, and proving determinism with byte-identical replay. It addresses production faults, including feed divergence and silent staleness, and closes with a full reference implementation.

Whether you're building your first feed handler or hardening your fourth, this book provides actionable techniques for securing correctness that holds under real load.

What You Will Learn

  • Define desynchronization precisely and distinguish it from mere staleness or low throughput
  • Build real zero-copy parsing without relying on assumed-safe string handling
  • Deconstruct feed latency into parsing, allocation, and recovery costs
  • Evaluate gap detection, retransmission, and reorder tolerance before deploying them
  • Verify correctness against allocation counts and canonical state hashing before shipping
  • Recognize and eliminate silent corruption sources without guessing at root cause
  • Know when a book state is proven correct versus merely untested
  • Design recovery for a loss-heavy, high-volume production environment

Who This Book Is For

This book is for C++ systems engineers, quantitative developers, and senior infrastructure engineers building or hardening a production feed handler. It's useful for engineers moving into latency-sensitive, high-throughput roles where correctness guarantees grow more complex. No prior binary protocol experience is assumed.

Table of Contents

  1. The Anatomy of a Market Data Feed
  2. FIX Protocol Parsing at Speed
  3. Binary Protocol Parsing with ITCH and OUCH
  4. Zero-Copy Deserialization Techniques
  5. Sequence Numbers and Gap Detection
  6. Gap Recovery Strategies
  7. Order Book Reconstruction from Raw Feed Data
  8. Multi-Feed Synchronization
  9. Measuring Parser Performance
  10. Deterministic Replay for Testing
  11. Fault Handling and Monitoring; Appendices
Vectorized C++

Vectorized C++

SIMD Intrinsics, AVX-512, ARM NEON, and std::simd — From Data Layout and Hardware Dispatch to Production Deployment

Learn to eliminate scalar throughput ceilings with confidence using measured, verified SIMD engineering, guided by a systems programmer’s playbook for data layout, hardware dispatch, and cross-architecture production deployment.

Key Features

  • Master the core SIMD disciplines used across real production systems, from register-level data layout through branchless execution and portable abstraction layers
  • Learn to eliminate hidden performance losses including alignment penalties, cross-lane shuffle bottlenecks, AVX-512 frequency throttling, and auto-vectorization failures
  • Build provable throughput without assuming correctness, using assembly inspection, hardware counter profiling, and cross-architecture regression testing before shipping

Book Description

Most engineers add SIMD to a codebase after it is slow, writing intrinsics around the hot loop without understanding why the surrounding code cannot be vectorized and without measuring whether the result is actually faster. This book closes that gap, providing the practical knowledge of memory layout, hardware execution models, and portable abstraction needed to build SIMD code with measured throughput, not assumed throughput.

You will begin at the silicon level, understanding what SIMD registers physically are, how parallel ALUs execute multiple lanes simultaneously, and why CPUID dispatch is an architectural decision rather than an afterthought. You will gain a clear framework for eliminating the layout problems that kill vectorization at its source, understanding where AoS data structures, misaligned allocations, and pointer aliasing introduce barriers, and how each compounds or gets eliminated under real load.

The book walks through the full arc of production SIMD engineering: x86 foundations from SSE through AVX2 and into AVX-512’s dedicated mask register file, ARM NEON’s interleaved load and store model, portable abstraction layers that compile to native instructions, and the compiler collaboration techniques that determine whether the auto-vectorizer succeeds or silently falls back to scalar. It addresses the algorithm cookbook problems that most SIMD resources skip entirely, including branchless search, vectorized sorting networks, and structural byte parsing for JSON and CSV at memory bandwidth rates. The book closes with benchmarking discipline, hardware counter profiling, and a complete fat binary deployment architecture with runtime ISA dispatch and cross-architecture regression testing.

Whether you are vectorizing your first numeric kernel or hardening a production SIMD codebase that targets a heterogeneous deployment fleet, this book provides actionable techniques for throughput that holds under real workloads and correctness that holds across every supported architecture.

What You Will Learn

  • Understand the silicon-level reality of SIMD lanes, parallel ALUs, and register file aliasing before writing a single intrinsic
  • Design memory layouts that feed vector units without stalling, choosing between AoS, SoA, and AoSoA with measured justification
  • Build branchless conditional logic using comparisons, masks, and blends that execute at full SIMD throughput with no branch prediction risk
  • Navigate AVX-512’s dedicated mask register file and per-lane predication model, including the frequency throttling trap that makes wider vectors slower on specific hardware
  • Evaluate portable abstraction libraries including Highway and xsimd against a zero-cost custom layer you design and verify yourself
  • Guide the compiler’s auto-vectorizer using restrict annotations, alignment hints, and loop restructuring, and recognize the failure modes where manual intrinsics are mandatory
  • Migrate raw intrinsic code to std::simd without sacrificing throughput, verified through assembly inspection and before-and-after benchmark comparison
  • Ship a fat binary with runtime ISA dispatch, OSXSAVE-guarded CPUID detection, and a cross-architecture regression test harness that catches correctness and performance regressions before deployment

Who This Book Is For

This book is for C++ systems engineers, performance engineers, and senior developers building or optimizing throughput-critical software across numeric computing, signal processing, database engines, financial systems, and any domain where scalar code leaves measurable hardware capacity unused. It is useful for engineers moving into low-latency or high-throughput roles where the gap between theoretical peak and measured throughput demands explanation. No prior SIMD experience is assumed. The book builds the mental model from first principles in Chapter 1 and every intrinsic is explained at the point of first use.

Table of Contents

  1. The Vector Execution Model and Data Layout
  2. x86 Foundations: SSE to AVX2
  3. AVX-512: Full-Width Predication and Trade-Offs
  4. ARM NEON and Apple Silicon
  5. Portable SIMD Abstractions
  6. The Compiler as Collaborator
  7. std::simd in Modern C++
  8. The SIMD Algorithm Cookbook
  9. Benchmarking, Profiling, and Shipping; Appendices
Deterministic Risk Engines in C++

Deterministic Risk Engines in C++

Lock-Free VaR Computation, Real-Time Stress Testing, and Cache-Aligned Position Tracking for High-Frequency Trading.

Learn to build fixed-latency risk infrastructure with confidence using lock-free engineering, guided by a production trading systems architect's playbook for cache-aligned state, incremental computation, and provable correctness under load.

Key Features

  • Master core reliability disciplines used across real production risk engines, from position tracking to fail-safe policy design
  • Learn to eliminate silent latency inflation, including false sharing, mutex contention, and unbounded recomputation on the order path
  • Build provable correctness without assuming it, using replay testing, property-based invariants, and reconciliation audits

Book Description

Most risk engines ship once they pass a quiet-market demo, unaware the same mutex or the same O(n) recomputation that looked fine in testing will stall the matching engine the day volatility actually spikes. This book closes that gap, providing the practical knowledge of cache-aligned state, lock-free publication, and incrementally-maintained risk figures needed to build a risk engine with measured latency guarantees, not assumed ones.

You will begin by deriving an actual latency budget from tick-to-fill time and realized adverse price movement, rather than picking a round number, and building position tracking that updates atomically as fills arrive without contending with the order path. You'll gain a clear framework for pre-trade risk checks, implementing size limits, fat-finger detection, and price collar validation as a fully lock-free gate ahead of the matching engine.

The book walks through the full arc of a production risk system: parametric VaR maintained incrementally rather than recomputed from scratch, live correlation and portfolio-level exposure decomposition, historical stress testing run in parallel without touching the fill path's cache lines, and full production resilience through fail-safe policy design, circuit breakers, and regulatory audit trails. It addresses correctness rigor, including replay testing against historical fills, property-based invariant checking, and reconciliation against independent end-of-day reference data, and closes with a full annotated reference implementation.

Whether you're building your first real-time risk gate or hardening your fourth, this book provides actionable techniques for securing latency guarantees that hold under live order flow.

What You Will Learn

  • Define false sharing, mutex contention, and unbounded recomputation precisely and distinguish them from ordinary latency noise
  • Build real lock-free position pipelines without relying on assumed-safe locking patterns
  • Deconstruct risk-check latency into algorithmic, memory-layout, and contention-driven components
  • Evaluate fail-closed and fail-open policy per check before committing to a fail-safe design
  • Verify correctness against replay testing and property-based invariants before trusting a result
  • Recognize and eliminate silent staleness sources without guessing at root cause
  • Know when a risk figure is provably current versus merely fast
  • Design fail-safe behavior for a bursty, contention-prone live trading environment

Who This Book Is For

This book is for C++ engineers, quantitative developers, and trading systems architects building or hardening a production risk engine. It's useful for engineers moving into low-latency infrastructure roles where correctness and speed are both non-negotiable. No prior risk management experience is assumed.

Table of Contents

  • Why Risk Engines Break Trading Systems
  • Position Tracking at Fill Time
  • Pre-Trade Risk Checks
  • Value at Risk Fundamentals for Engineers
  • Lock-Free VaR Recomputation
  • Correlation and Portfolio-Level Exposure
  • Real-Time Stress Testing
  • Measuring Risk Engine Overhead
  • Deterministic Testing for Risk Logic
  • Fault Handling and Fail-Safe Behavior
  • Auditability and Post-Trade Reconciliation; Appendices
Ultra-Low-Latency C++ Trading Systems

Ultra-Low-Latency C++ Trading Systems

Integrating Matching Engines, Risk Controls, and FPGA Execution into a Single Deterministic Pipeline.

Stop treating your matching engine, risk gate, and FPGA layer as three problems you've already solved. The fourth problem, the one that only shows up once all three run together against live order flow, is what this book is about.

Key Features
  • Learn why four correct components, a matching engine, a risk engine, a market data feed, and an FPGA gateway, routinely combine into an incorrect system, and build the explicit contracts at every seam that closes that gap
  • Engineer a deterministic pipeline: a shared latency budget across four subsystems, a synchronous risk gate that can't be outrun, sequence-ordered event flow, and clock-domain reconciliation between host and hardware
  • Take the system from a passing demo to a field-tested build with correlated chaos testing, byte-identical replay, verified recovery objectives under combined failure, and a deployment strategy for hardware that can't restart instantly
Book Description

A matching engine that passes its own test suite, a risk engine that rejects every order it should, and an FPGA gateway that hits its latency target on the bench are not a trading system. They're three sign-offs, and the gap between them and one correct system is where integrated systems fail, silently, the first day all four run together against real order flow.

It treats that gap as the engineering problem it is, opening with a real end-to-end latency budget across market data, matching, risk, and FPGA execution, one shared clock semantics per boundary rather than four privately defined numbers added together. It wires the risk gate into the hot path as a synchronous check, passes exposure state across boundaries without added latency, and integrates the FPGA layer with a software fallback tested continuously, not a codepath nobody has run in months.

The middle chapters build cross-component reliability: fault recovery ordering across subsystems with independent recovery paths, system-wide determinism through a shared sequence and clock reconciliation at the hardware boundary, and graceful degradation that scopes a fault rather than forcing an unnecessary halt.

The final part proves the system works: latency measurement with per-stage attribution finding which subsystem regressed, deterministic replay reproducing a session byte-for-byte, and chaos testing injecting correlated, simultaneous failures single-fault testing cannot find. It closes with production operation: alerting tied to the real system budget, and a deployment strategy treating hardware-software compatibility as a checked contract.

What You Will Learn
  • Define a shared end-to-end latency budget across market data, matching, risk, and FPGA execution
  • Wire a pre-trade risk gate into the hot path so it cannot be outrun, and pass exposure state without staleness
  • Integrate an FPGA layer with a tested software fallback and an order-state authority that survives failover
  • Coordinate fault recovery across subsystems without trusting another component's stale state
  • Achieve system-wide determinism with a shared sequence, typed ordering keys, and host-hardware clock sync
  • Build graceful degradation that scopes a fault and composes simultaneous conditions into one answer
  • Measure true end-to-end latency and attribute a tail regression to the responsible subsystem
  • Build deterministic, byte-identical replay and step through it to diagnose a live bug directly
  • Chaos-test correlated failures and verify your recovery objective under combined failure
  • Operate the system with budget-derived alerting and a rollback strategy safe for hardware
Who This Book Is For

This book is for C++ systems engineers, quantitative infrastructure teams, and trading technology leads who have built one component of a trading pipeline and are now responsible for making several work together. Familiarity with modern C++ is assumed.

Table of Contents
  • Why Integration Is Where Systems Actually Fail
  • Event Flow from Market Data to Order Decision
  • Wiring the Risk Engine into the Hot Path
  • Integrating the FPGA Acceleration Layer
  • Consistent Fault Recovery Across Subsystems
  • System-Wide Determinism
  • Graceful Degradation Under Partial Failure
  • End-to-End Latency Measurement
  • System-Level Deterministic Replay
  • Chaos Testing the Full Pipeline
  • Operating the System in Production
  • Appendices

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub