CppCon 2017: Carl Cook “When a Microsecond Is an Eternity: High Performance Trading Systems in C++”

Channel:CppCon · Length:1:00:07 · Published:2017-10-08 · Views:360406

Watch on YouTube

Summary

Optiver's Carl Cook explains how to build high-frequency trading systems in C++, where the critical path runs rarely but must be extremely fast. He covers techniques for low and predictable latency, including avoiding main memory and cache misses.

Why HN recommends it

HN repeatedly points people to it as the best overview of low-latency trading engineering.

Here are some talks that will give you a small overview into that world — HN, 2020

C, C++, Rust, Go & systems languages · Software performance & optimization

Subtitles (excerpt)

- Cool so yeah, good afternoon everyone. My name is Carl, I work for a company called Optiver. I work writing automated trading systems and I've done that for about 10 years in total. So today's talk is just going to be basically a day in the life of a developer of high frequency trading systems. I'm also a member of SG14, so I try to give a little bit of feedback from the trading community into their standards. What's important from the low latency perspective from trading. But I'm definitely not a C++ expert. There's people in this room who will know 10 times more about C++ than me. It's not necessarily a problem though. You just need to be really good at measurement. You need to be really good at applying scientific method. You need to understand the tools. If you can do that and you can measure and you can measure well, you can write very very fast software without knowing the standard inside out. So I'm gonna give a very quick overview of what we do. Won't go into that in much detail, 'cuz that can take an hour or two just by itself. But I will talk about the technical challenges that we face. Those two topics are just an introductory, then we get into the real stuff, which is the actual techniques that I use on a daily basis for writing fast C++.

On Hacker News

Doesn't the fact that a modern FPGA-centric (probably ASICs in the mix too at this point) hybrid NIC/order-parser/state-machine thing is rumored to be able to hit glass-to-glass of ~20-40ns mean that the speed game is hotter than ever? Do you mean that because it involves a lot of hardware design now? The days of being able to offer around the inside in C++ on a regulated securities exchange are … — benreesman, 2025-08
This is almost certainly incorrect, unless it’s using a very stretched definition of “hft” and using microseconds to mean 99th% <1ms instead of say <5us (reasonably competitive software range depending on your trade). They might be forwarding non latency sensitive client/internal orders through a system written in erlang, or using erlang for an orchestration layer, but they’re not competing with … — vgatherps, 2023-09
I find this stuff fascinating, and this article is way above average for online posts about proprietary/algorithmic/quantitative/low-latency trading (very leaky Venn diagram there). I have a few nitpicks but overall it's informative and it's an interesting format: viewing an industry through the lens of a particular firm, especially one as fascinating as Jane. Anything that develops literacy in m… — benreesman, 2022-08
First of all, it leaves the team behind if you use features that are too advanced. Makes collaboration hard if you have wildly diverging skills (in both ways). Also, it did in our case take you away so far from the bare metal, that the code was elegant, but slow. It did not play well with our static allocators and allocated/deallocated way too much, especially temporaries. You might i.e. check ou… — jeffreygoesto, 2020-11
I’ve seen this sentiment before and worked on both a “low latency Java” team and low latency C++ teams. I have some sympathy for the idea that the JVM is better since it means you won’t spend all your time chasing crash reports. The thing is, like another comment hinted at, is that this issue is generally more reflective of the environment you build in than the technology choice. Here’s a good ta… — vgatherps, 2020-11

Related videos