I read your question here on stackexchange and was curious myself, so I did a little digging and came across this:
A thread on Quora
Where can I learn C++ for HFT?
Theodore Weld Smith (programming primarily in C++ and OCaml) answered:
One of the biggest distinctions from what C++ looks like for HFT
versus in other applications is the latency aspect.
Writing good low latency code means
- knowing how concurrency and parallelism works and how to use it
- knowing what exactly the compiler is doing
- knowing how memory is being dealt with
- knowing how to write code for the specific hardware in use
- knowing how the OS kernel the algorithm operates on works, and how to deal with it (e.g., kernel bypassing)
There are a bunch of things you can do in C++ that will “simulate”
what HFT work is like; thus preparing you for it.
- Writing device drivers (C or C++)
- Using and learning about how frameworks such as CUDA work.
- Learn about how the FIX protocol works"
And Daniel Wisehart (Longtime C/C++ Developer) answered:
Start by learning to write simple, clean C++ that is easy to
understand by any competent developer with as little magic or reliance
on the compiler to do the right thing as possible. Your intentions
should be as clear to the compiler as they are to another developer.
Some shops use libraries where they have no idea what is happening
under the hood, but most prefer to roll their own for low-latency
pathways. This means it is good for you to understand some of the
issues confronted when writing those magic libraries, especially
within the narrow set of problems you will deal with.
For example, a sorting library may have all sorts of optimizations for
all sorts of initial conditions qsort will encounter, but if you only
do insertion sorts—which is a common implementation in HFT—you really
neither need nor desire a sorting library that handles the generic
You will use a lot of hash map’s, but there are a lot of things hash
maps can be optimized to do—such as merge or an apply—that you will
likely never use. So you need to understand how to create a hash that
is optimally sized for the number of entries you will deal with,
statically allocate what you can and pool memory that will take care
of hash collisions. Even if the firm already has an optimal hash for
their use, you need to understand how it works, what choices were made
and why other options were not pursued.
The more you can understand about the hardware you are running on, the
better. With modern processors there are various rings of memory
around the ALUs, and as you get further away from the ALU, the number
of cycles to access something increases. We have a saying on this: in
the old days, memory was fast, but if you had to go to disk you missed
the trade because it was just too slow. Today, cache memory is fast,
but if you have to go to main memory, you missed the trade.
We ran the entire Linux O/S in main memory on diskless machines—OK,
there was a little bit of disk for local logging in case of a network
failure, but no code was stored there—and we tried to keep everything
in the trading code path in layer two cache or better. NICs with DCA
(direct cache access) and user space data—aka kernel bypass—helped a
If you have a good understanding of all the code—yours, the libraries
and the O/S—that runs from network to application back to network, you
will be a real asset as a C++ developer for an HFT firm.
I know that might not be directly what you were looking for, but I hope it answers some of your questions.
Also, if you are interested to learn more about how to use Rust instead of C++ for quant trading, especially when trading on the blockchain, feel free to contact me on Discord. We are currently building a quant trading system in Rust. My discord is "Pierre#7374"