Leanpub Header

Skip to main content

The Complete Low-Latency C++ and HFT Architectural Suite

Master high-frequency trading infrastructure. This comprehensive 5-volume architectural suite teaches you to design deterministic matching engines, zero-copy feed handlers, lock-free risk gates, and bare-metal FPGA acceleration layers in modern C++.

Bought separately

$318.96

Minimum price

$129

$199

You pay

Author earns

$

Also available for 6 book credits with a Reader Membership

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

About

About the Bundle

The Definitive, Production-Ready Blueprint for Nanosecond-Scale Electronic Trading Infrastructure

In the hyper-competitive world of High-Frequency Trading (HFT) and ultra-low latency infrastructure, traditional software abstractions collapse. Squeezing maximum throughput out of modern hardware pipelines requires a brutal engineering focus on cache alignment, lock-free concurrency, kernel bypass, and hardware-software co-design.

Written under the professional direction of systems performance engineer Weston Ashgrove, this comprehensive 5-volume architectural suite bridges the massive gap between academic C++ syntax and battle-tested, production-grade electronic trading fabrics.

What is Included inside This Flagship Suite:

1. Deterministic Matching Engines in C++23/26: Master the mechanical execution loops of high-throughput order books, price-time priority structures, and zero-allocation memory arrays.

2. Bare-Metal Market Data Engines in C++: Engineer zero-copy feed handlers, streaming zero-allocation parsers, and low-jitter message-passing ring buffers.

3. Bare-Metal FPGA Acceleration for C++ Trading Systems: Unlock extreme hardware acceleration. Master PCIe DMA transfers, register-level communication, and clock-domain execution synchronization loops to offload critical paths completely.

4. Deterministic Risk Engines in C++: Build non-blocking pre-trade risk gates, high-speed position-tracking networks, and streaming lock-free Value at Risk (VaR) computation layers.

5. Ultra-Low-Latency C++ Trading Systems: The grand integration master blueprint. Learn how to map core components cleanly into CPU cache lines, enforce thread affinity, and manage end-to-end tail latency under extreme market volatility.

Core Engineering Methodologies You Will Master:

• Kernel Bypass Ingestion: Utilizing DPDK and Solarflare architectures to pass network packets directly to processing threads, bypassing operating system overhead entirely.

• Lock-Free Concurrency: Eliminating traditional thread contention, mutexes, and context switches using advanced ring buffers and atomic operations.

• Hardware Optimization: Maximizing L1, L2, and L3 cache locality, enforcing cache line alignment, preventing false sharing, and optimizing Translation Lookaside Buffers (TLB).

• Deterministic Execution: Eliminating runtime jitter caused by standard heap allocations by building specialized custom memory allocators.

Who This Suite is Engineered For:

This collection is built specifically for Senior Systems Engineers, Quantitative Developers, Financial Infrastructure Architects, and Technical Managers looking to train engineering desks on production-ready low-latency design patterns.

Skip the theoretical abstractions. Equip your development team with the exact architectural engineering frameworks required to out-compete the global market.

Books

About the Books

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
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
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
Bare-Metal FPGA Acceleration for C++ Trading Systems

Bare-Metal FPGA Acceleration for C++ Trading Systems

HDL Design, PCIe/DMA Transfer, and Clock-Domain Synchronization for Sub-Micro second Execution.

Learn to accelerate C++ trading systems below the software latency floor using HDL design, PCIe DMA transfer, and clock-domain synchronization, guided by a trading systems architect's playbook for building and proving sub-microsecond hardware execution paths.

Key Features

  • Master the FPGA build pipeline for trading infrastructure, from HDL fundamentals through timing closure and field deployment
  • Design safe PCIe DMA and clock-domain-crossing paths that eliminate CPU jitter without introducing silent correctness bugs
  • Build provable latency claims using instrumented timestamping, formal verification, and replayed market data

Book Description

Most software-only trading gateways hit a latency floor no further C++ optimization can move, because the cost sits in kernel network stacks, PCIe round trips, and OS scheduling jitter below what a profiler can see. This book closes that gap, providing the HDL design, DMA transfer, and clock-domain synchronization knowledge needed to move market data ingestion and a bounded slice of decision logic into FPGA fabric, with a measured latency improvement, not an assumed one.

You will begin by mapping where software's nanoseconds go, then translate C++ intuitions into correct HDL execution models before setting up a repeatable build and simulation pipeline. You'll gain a framework for drawing the hardware/software boundary, keeping stateless, fixed-format logic in fabric while leaving stateful decision logic in software, and building the DMA and clock-crossing paths that connect the two without adding jitter.

The book walks through a production FPGA gateway: wire-to-logic ingestion, timing closure across worst-case corners, hardware-timestamped latency measurement against a software baseline, and production resilience through formal verification, hardware-in-the-loop replay testing, dual-bank deployment, and automatic software fallback. It closes with a full annotated reference design, a timing report walkthrough, anonymized field post-mortems, and a clock-domain-crossing pattern reference.

Whether you're building your first hardware-accelerated gateway or hardening one in production, this book provides techniques for securing latency guarantees that hold under real silicon, not just in simulation.

What You Will Learn

  • Define combinational depth, clock-domain crossing hazards, and route-delay violations and distinguish them from logic bugs
  • Translate C++ execution intuitions into correct, synthesizable HDL without mistakes that pass simulation and fail silicon
  • Draw a defensible hardware/software boundary based on statelessness, not on what looks simple to implement
  • Build safe PCIe DMA paths and dual flip-flop or FIFO-based clock-domain crossings that avoid metastability
  • Verify correctness against formal properties and replayed market data before trusting a timing report
  • Resolve setup and hold timing violations without over-pipelining or over-constraining the design
  • Know when a latency figure is measured end to end versus assembled from disjoint estimates
  • Design fail-safe fallback and field monitoring for hardware that will, eventually, degrade

Who This Book Is For

This book is for C++ engineers, trading systems architects, and infrastructure developers building or hardening an FPGA-accelerated trading gateway, moving from pure software low-latency work into hardware acceleration roles. No prior HDL experience is assumed.

Table of Contents

  1. Why Software Alone Hits a Latency Floor
  2. HDL Fundamentals for C++ Engineers
  3. FPGA Toolchains and Development Flow
  4. Wire-to-Logic Ingestion in Hardware
  5. Interfacing with the Matching Engine Boundary
  6. PCIe and DMA Transfer Design
  7. Clock Domain Crossing and Synchronization
  8. Timing Closure and Meeting the Latency Budget
  9. Measuring End-to-End Hardware Latency
  10. Testing and Verification in Hardware
  11. Deployment and Field Reliability; 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

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