VenomEngine
Personal — High-Frequency Trading Simulation
January 2026 — Present
Overview
VenomEngine is a high-performance, C++23-based matching engine and quantitative risk suite designed to simulate a High-Frequency Trading (HFT) environment. The project focuses on nanosecond-level execution and hardware-aware mathematical computations to achieve deterministic, sub-microsecond latency.
The name is a play on Order Flow Toxicity, which occurs when liquidity providers are adversely selected by informed traders. The engine is specifically architected to detect this "venom" in real-time using the VPIN metric, utilizing AVX-512 vectorization to identify toxic shifts before price discovery "bites" the market maker.
Technical Specifications
- Memory Management: To prevent latency spikes, the engine enforces a Zero-Allocation Policy.
Orders are managed via a pre-allocated
OrderPoolarena, and theOrderstruct is aligned to 64-byte L1 cache lines to prevent false sharing. - Order Book Architecture: Uses a sparse array price ladder for O(1) direct mapping rather than binary search trees.
Discovery of the best bid/ask is accelerated using hardware-accelerated bitsets combined with
TZCNTinstructions. - Quantitative Risk Engine: Calculates VPIN (Volume-synchronized Probability of Informed Trading) using SIMD batching. Volume imbalances across 16+ buckets are calculated in parallel using AVX-512 intrinsics to maintain hardware-level throughput.
- Concurrency & Layout: The system utilizes CPU pinning and isolated execution cores to prevent OS context switching. Inter-thread communication is handled via lock-free SPSC queues with cache-line padding.