We Just Made Trading Signals Microsecond-Level Easy — 100 Factors in 40µs | by DolphinDB | MediumSitemapOpen in appSign up<br>Sign in
Medium Logo
Get app<br>Write
Search
Sign up<br>Sign in
We Just Made Trading Signals Microsecond-Level Easy — 100 Factors in 40µs
DolphinDB
6 min read·<br>Dec 9, 2025
Listen
Share
Press enter or click to view image in full size
Quantitative trading boils down to one core objective: identifying and exploiting market inefficiencies. Like a gecko frozen in anticipation of its prey, the quant trader must act with precision the instant an opportunity emerges — then resume the wait.<br>In today’s intensely competitive landscape, however, spotting opportunities and seizing them are two entirely different challenges. Discovery hinges on creative factor design and modeling; capture depends on raw speed and technical execution. This is a ruthless contest governed by hardware constraints, exhaustive optimization cycles, and one uncompromising imperative: be fast — then be faster.<br>Consequently, C++ has emerged as the industry standard for ultra-low-latency trading infrastructure. But this choice comes with significant costs: while C++ excels at runtime performance, it considerably slows the development lifecycle, limiting agility and escalating maintenance overhead.<br>Now, there’s a compelling alternative. DolphinDB’s scripting environment enables traders to construct factor models and strategies that combine Python-like development speed with production performance matching elite C++ implementations. The critical question is whether this dual advantage in engineering efficiency and computational speed could fundamentally transform quantitative trading.<br>To put this to the test, we benchmarked the computational performance of Swordfish by testing nearly 150 factors of varying complexity, and comparing its latency against a highly optimized C++ framework.<br>The findings are striking:<br>For the ten most intricate, fully custom Level-2 factors, Swordfish recorded a minimum latency of just 4.4 microseconds.<br>Across 100 production-grade factors deployed in live trading environments, the average latency was approximately 40 microseconds.<br>Pushing Performance Boundaries: 100-Factor Computation in 40 Microseconds<br>In this benchmark, we assessed the performance and reliability of the Swordfish through two comprehensive evaluations.<br>The initial phase analyzed 40 factors constructed from Level 1 market data (including standard quotes and trades) and Level 2 market data (encompassing order book depth and queue information). We measured latency for single-factor execution and ten-factor batches, while monitoring the marginal latency increase as each additional factor was introduced.<br>In the subsequent phase, we examined 100 production-ready factors currently deployed in live trading environments. This comparison pitted Swordfish against a rigorously optimized native C++ factor computation engine, with particular attention to how concurrent processing impacts overall system reliability.<br>Our test dataset comprised 10 minutes of Level 2 market data spanning 645 securities — representing 5.21 million individual data records. All performance tests were executed on an 8-core server infrastructure provided by Rongchaowei.<br>Latency Results: Single-Factor vs. Ten-Factor Performance Across Complexity Tiers<br>Press enter or click to view image in full size
Whether processing straightforward or highly complex factors, Swordfish consistently delivered single-factor latency between 1–2 microseconds. When computing 10 factors concurrently, average latency held steady at approximately 4 microseconds.<br>The stability metrics are equally impressive. For the most computationally intensive Level 2 custom factors, each additional factor contributed only 260 nanoseconds of marginal latency — demonstrating exceptional scalability and predictable performance characteristics.<br>Swordfish Scripting vs. C++: Head-to-Head Performance with 100 Production Factors<br>In the second phase of our evaluation, we selected 100 production-grade C++ indicators — all highly complex Level 2 custom factors — and reimplemented them using DLang (DolphinDB’s scripting language) to benchmark Swordfish’s computational performance.<br>The findings demonstrate that Swordfish now matches the performance of meticulously optimized C++ computation engines.<br>100 Factors computed in 40 μs: Under identical conditions, the conventional C++ implementation recorded an average latency of approximately 139 μs, whereas Swordfish achieved an average of just 42 μs. Across 100 factors, average latency measured 42.7 μs with a 99th percentile of 45.9 μs — demonstrating exceptional performance consistency. This improvement in computational speed directly translates to higher strategy win rates, enabling traders to capture fleeting opportunities that would otherwise be lost to latency delays.
Multi-concurrency stability: Under concurrent workloads, 99% of requests completed within 46 μs , with...