Skip to content
0:00 / 0:00

#lowlatency#high-frequencytrading#cachemisses

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

CppCon

189K subscribers • 94 videos on Hallway • Conference channel

YouTube
  • Recommended by 6 people: 5 on Hacker News and 1 on Lobsters.
  • A classic. People kept recommending it from 2017 to 2025.
  • Presented by Carl Cook, Optiver
  • Linked in the descriptionCppCon/CppCon2017

Advanced. Deep dive for people who know the field.

357K views9 years ago6 recommendations

Systems programmingProgramming languagesC++Performance and optimizationConcurrency and parallelism

Carl Cook explains the C++ optimization techniques used to build ultra-low latency automated trading systems at Optiver.

CppCon.org — Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/CppCon/CppCon2017 — Automated trading involves submitting electronic orders rapidly when opportunities arise. But it’s harder than it seems: either your system is the fastest and you make the trade, or you get nothing. This is a considerable challenge for any C++ developer - the critical path is only a fraction of the total codebase, it is invoked infrequently and unpredictably, yet must execute quickly and without delay. Unfortunately we can’t rely on the help of compilers, operating systems and standard hardware, as they typically aim for maximum throughput and fairness across all processes. This talk describes how successful low latency trading systems can be developed in C++, demonstrating common coding techniques used to reduce execution times. While automated trading is used as the motivation for this talk, the topics discussed are equally valid to other domains such as game development and soft real-time processing. — Carl Cook: Optiver, Software Engineer Carl has a Ph.D. from the University of Canterbury, New Zealand, graduating in 2006. He currently works for Optiver, a global electronic market maker, where he is tasked with adding new trading features into the execution stack while continually reducing latencies. Carl is also an active member of SG14, making sure that requirements from the automated trading industry are represented. He is currently assisting with several proposals, including non-allocating standard functions, fast containers, and CPU affinity/cache control. — Videos Filmed & Edited by Bash Films: BashFilms.com Work at Hudson River Trading (HRT): tinyurl.com/safxfctf --- Videos Filmed & Edited by Bash Films: BashFilms.com

Why it's here

6 people recommend this

What people say. Engineers frequently recommend this talk for its practical, deep-dive techniques on micro-optimization and low-latency systems design.

log_base_loginon Hacker News • Recommends

On “Coders who trade: Wall Street designs its staff for the future”

…e that you are likely working exclusively in Haskell, but thought you might derive some value from Carl Cook's presentation on optimizing HFT code at the most recent cpp convention. I recognize the languages are distinctly different, but he provides some interesting theoretical points along the way that might be advantageous to you. Here's a link: link to this video Also, I can sympathize with your plight to run scalable sims. I've done some work in bioinformatics, and am building a small cluster at home so that I can learn to write code that'll scale to more massively parallel systems that are de rigueur in that domain. Cheers!…

pjmlpon Hacker News • Recommends

On “Ask HN: What programming skills are required by HFT or Trading firms”

…able to write allocation free algorithms, even on GC languages, lock free data structures and good knowledge of all multi-core programming paradigms and distributed computing. Here are some talks that will give you a small overview into that world, CppCon 2017: Carl Cook “When a Microsecond Is an Eternity: High Performance Trading Systems in C++” link to this video Core C++ 2019 :: Nimrod Sapir :: High Frequency Trading and Ultra Low Latency development techniques link Open source Java HFT code from Chronicle Software, link "Writing and Testing High-Frequency Trading Engines", from Cliff Click link However in these domains every ms counts, even how long cables are, so also expect Verilog, VHDL,…

jeffreygoestoon Hacker News • Recommends

On “Ask HN: Am I too late for the “Data Science” wave?”

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 out talks like 0. 0 link to this video

vgatherpson Hacker News • Recommends

On “Java is better than C++ for high speed trading systems”

…athy 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 talk on the reasons for and limits of using C++ for low latency systems: link to this video If I had to rank in terms of reliability of trading infrastructure I’ve used/worked on, * Low Latency C / C++ infra at fully automated trading firm. Very much run by the programmers and quants and also fairly small. By far the fastest (near limits of what you could do) and also most reliable. * Low Latency Java execution infrastructure. Pre…

benreesmanon Hacker News • Recommends

On “Understanding Jane Street”

…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 modern finance amongst the lay public is a good thing in my book. If this stuff floats your boat I'd also recommend any of Carl Cook's talks, e.g. link to this video . Optiver is AFAIK in a somewhat different business than Jane, but they're also players (or were last I had any inside baseball). Too many people got their worldview on this industry from "Flash Boys", and I say this as a Lewis fan, is criminally stupid at best and in bad faith at worst (if you want a well-researched, accessible alternative…

vgatherpson Hacker News • Recommends

On “Unpacking Elixir: Real-Time and Latency”

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 other hft traders in one. Source: I work in the field and have built <5us systems. link to this video Is a free great watch about the things you have to do to very reliably have such low latencies

benreesmanon Hacker News • Recommends

On “HRT's Python fork: Leveraging PEP 690 for faster imports”

…ities exchange are over, but there's still C++ driving the thing, that 20ns "tick to trade" or however it's being measured in some instance is still pretty basic response stuff, light speed is still a thing. There's a C++ program upstairs running the show, and it's trying to do it's job in under a mike for sure. The OG talk on this is Carl Cook's: link to this video But there are more recent talks (Optiver is especially transparent about it but other people talk about it too): link , that's David Gross at CppCon last year, it can't have changed that much since last year.…

mikejsavageon Lobsters • Recommends

When a Microsecond Is an Eternity: High Performance Trading Systems in C++

u/matthieumin r/ProgrammingLanguages • Mentions

On “Seldom mentioned”

> But we are still getting faster and I don't think most of you people seem to comprehend that. At least based on what you've done I don't think you do. Thanks for the condescension... > In short, if you want to make something long-standing, you have to think really big and understand that you have a huge capacity of computer power in your casual reach. *Oh my... I laughed so hard I nearly fell from my chair.* I am afraid you are woefully unfamiliar with Parkinson's law, published in 1955: > Work expands so as to fill the time available for its completion. Instead of wasting too much computing power on an exhaustive reply, I'll leave it to Carl Cook instead: [When a Microsecond is an e…

zeuskon Hacker News • Mentions

On “Intel 28-core fantasy vs. AMD 32-core reality”

> I can imagine few cases where first-to-right-the-bell performance on a single core determines if you get a specific quote in HFT but that's that. That is actually the case from what I've heard, A lot of them buy consumer chips then disable all but one core and overclock it to the max. Here is a guy from optiver talking about their process at CppCon: link to this video

pjmlpon Hacker News • Mentions

On “A possible new back end for Rust”

Enough theory, "Scientific Computing: C++ Versus Fortran" (1997) link "Micro-Optimisation in C++: HFT and Beyond" link "The Speed Game: Automated Trading Systems in C++" link "When a Microsecond Is an Eternity: High Performance Trading Systems in C++" link to this video

kolbeon Hacker News • Mentions

On “Magic-trace – High-resolution traces of what a process is doing”

Do you know this for a fact? I've done some work in the industry where I needed to make fast software, but never the like sub-microsecond tick-to-trade type fast, so I really don't know. There was a great presentation from 2017 about some of Optiver's low latency techniques1. I had assumed they released it because the had obviated all of them by switching to FPGAs, but I don't know. Either way, he suggested that if you ever needed to ping main memory for anything, you already lost. So, I wouldn't have thought DDIO plays into their thinking much. 1 link to this video