Skip to content

← Selected work/01

HFT Trading Simulator

Educational high-frequency trading simulator — real low-latency engineering, zero real money.

Period
Jun–Sep 2026
Role
Design & implementation
Commits
1,289
Key metric
75+ quant models · 191+ live panels · FIX 4.4
Links
Repo ↗
System diagram
feedfix 4.4c++20 signal enginespsc rings · lock-freehmm regime · baum-welch75+ quant modelsonnx inference · branchlesscache-line alignedshm ipcc++ ↔ pythonrust executororder hot pathcuda batchmodel computedashboards191+ panelstickssynthetic market data · regime bands · sub-ms switching

Problem

HFT systems are where software engineering meets physics: nanoseconds matter, allocation is a bug, and a cache miss is a design flaw. I wanted to learn that discipline for real — not by reading about it, but by building a simulator that behaves like a production trading stack, without risking a cent.

Constraints

Educational by definition: zero real money, zero real risk. But the engineering had to be honest — lock-free where a real desk would be lock-free, IPC where real systems use shared memory, and models that a quant would actually recognize.

Architecture

A C++20 signal engine sits at the core, exchanging data with a Python research layer over shared-memory IPC — the same pattern real trading firms use between strategy and execution. A Rust order executor handles the hot path, CUDA accelerates batch computation, and 191+ React dashboard panels render the whole system live.

Key decisions

  • Lock-free SPSC ring buffers with cache-line alignment and branchless programming — no mutexes on the hot path.
  • Signal Engine V3: HMM regime detection with online Baum-Welch adaptation and Viterbi decoding — sub-millisecond regime switching.
  • 75+ quantitative models: GARCH, Kalman filters, Almgren–Chriss optimal execution, and more — each validated, not stubbed.
  • ONNX ML inference in C++ — trained models run inside the engine, not in a Python sidecar.
  • FIX 4.4 protocol support — the wire format real markets speak.
  • AI-assisted hot-path tuning — model-suggested memory-layout and cache-line tweaks on hand-written C++ were benchmarked and adopted where they measured faster; the rest were rejected.

What it proves

Multi-language systems engineering (C++20, Rust, Python, CUDA, TypeScript) with a full CI/CD pipeline across all of them and Kubernetes/Helm deployment. The hard parts — shared memory, lock-free queues, numeric kernels — are real, not simulated.