1) Network layer: raw TCP sockets with binary packed messages (sometimes structs directly cast to and from raw buffers, keeping network/host byte order in mind); separate message data dictionary to avoid metadata overhead inside messages.
2) Processing: optimised C++ code; pointers; multi-threaded processes that utilise all available cores; minimal locking and contention between threads (queues with spin locks and bulk transfers); threads directly bound to CPU cores (prevent context switching overhead); prevent heap locks by allocating large object pools at startup;
3) Disk I/O: minimise disk I/O in logic-heavy, low latency threads; application level in-memory disk write queues; prefer append mode writes; application level in-memory caches (basically hash maps of reference data loaded at startup)
4) None of the "trendy" programming practices: no OOP design patterns; no dependency injection; functional programming, but without fluent APIs;
5) No popular frameworks: internally developed solutions optimised for our specific use cases, instead of off the shelf libraries or frameworks (e.g. the messaging middleware was in-house)
There is more, but this is what I could think of, off the top of my head.
Some neat tricks people have done is to actually process packet bytes in order as they come in on the FPGA, and if it has some actionable header they just send an action before the entire trade packet is received. With that you can go down into the few ns for your w2w latency.
The system programming languages (C / C++ / Rust) will always have more overhead than FPGAs.
A microsecond is fast for C++. It’s like an eternity for an FPGA.
userspace networking with one thread busy polling, all power state management + ht disabled with receive packet steering
This book was good https://www.amazon.ca/Advances-Financial-Machine-Learning-Ma... in that is sort of explains at a high level how you'd build a company to look at something like this (think it was one of the last chapters). You'll need extremely deep/skilled hardware/networking groups, data acquisitions (think packet capture to data) folks, people to clean and maintenance massive the data repos, internal tool teams, quantitative analysts, traders, management/admin, etc. At this level just getting the fiber to each exchange likely costs many many millions. When you go and look through those job postings you can sort of slot these into your mental model of this flow and start to see how it might be put together.
That book is good but if you are new to the topic it will be almost unreadable. At least it was for me. I had to read it 3-4 times over the years and still find new things as my knowledge grows.
I don't know if rentec is a HFT firm or what strategies they use but this was a really good interview with one of the founders https://www.youtube.com/watch?v=QNznD9hMEh0.
I've never worked in US financial markets, but that's def not true in many countries.
< 400 USD / month can set you a server + connection within a B3 datacenter (Brazil's largest and only exchange).
I’ve been out of HFT for a long time but when I was in it you could get onto the state of the art microwave networks between Chicago and the east coast for ~25k a month, which isn’t cheap but also not the biggest expense an HFT firm would have.
HFT is a combination of lots of things: low-level computer architecture knowledge, hardware engineering, computer networking, numerical computing, machine learning, super-computing, market simulation, market microstructure knowledge, risk management, financing, psychology/game-theory, etc etc.
Usually no one person is in expert in all of those areas. Usually, a firm is successful because they put together a world class team with all of those skillsets AND they’re willing to invest heavily in the right things.
And even then, it’s so competitive that you can still fail. It’s quite challenging to get everything right. There are far more ways to fail than to succeed.
I’d suggest you pick some sub-area you’re interested and focus heavily on that.
Algorithmic Trading & DMA by Barry Johnson
Trading and Exchanges: Market Microstructure for Practitioners by Larry Harris
You might also be interested in 'yummyfajitas blog:
https://www.chrisstucchio.com/blog/2012/hft_apology.html
If people have up to date replacements for these books, I'd be super interested.
If you keep asking around, people are gunnuh recommend Reminiscences of a Stock Operator, and it's an enjoyable book but keep in mind that it's basically the fictionalized biography of a problem gambler who happened to operate in the stock market, he traded recklessly and died destitute (by suicide - when you reread it, you start to notice how he never mentions enjoying anything, or talks about the people in his life in more than passing). Don't take it too seriously.
Also read up on branchless programming, lock-free data structures and avoiding heap-allocations.
Beware, the more you read about the practices of HFT firms the more some of it looks like fraud on a grand scale. For example, front running orders is a common practice that goes unpunished for HFT firms but will land you or I in jail.
I got into algorithmic trading and HFT when I was dabbling in bot trading cryptocurrencies. The wild west of crypto bot trading is pretty much gone now but man it was fun while it lasted.
In addition to the algorithmic trading books suggested I found these links helpful: https://www.quantstart.com/articles/Beginners-Guide-to-Quant...
https://www.youtube.com/watch?v=rB5jJuMP84E - just neat
https://www.youtube.com/watch?v=oUVchh37AO8
https://www.youtube.com/watch?v=bo-F61ZuBDg - 2010 flash crash
I was at a top trading shop and we and other places take compliance pretty seriously nowadays. Otherwise (if you aren't a prop firm) you'll lose clients, get fined, lose reputation, etc.
Also fyi being the very fastest has diminishing returns. You are at the whim of the exchange's matching engine processing order, which may be nondeterministic.
There are places nowadays that derive their edge from fast hw/sw, but increasingly, the most successful places are ones with the smarter strategies, higher volume, and more products traded.
Jane Street's podcast and blog are insightful too [2]. I read somewhere that Dr. Simons (one of the founds of RenTech) has this book in his office [3].
0. https://blog.headlandstech.com/2017/08/03/quantitative-tradi...
1. https://blog.headlandstech.com/
2. https://blog.janestreet.com/ and https://signalsandthreads.com/
3. The Econometrics of Financial Markets, https://www.amazon.com/gp/product/0691043019/
I've had a lot of people on Hacker News very confidently tell me that I have no idea what I'm talking about on this topic. For a long time I thought I was just dumb, but still employed years later and have realized that most of the people that 'correct' me have exactly 0 experience.
(From someone who also gets defensive in online comments. I don't think they per say told you that you were wrong, but rather described their experience in relation to what you'd said. It seemed to me like commentary more than criticism. I don't have a crystal ball to tell me when people are exaggerating their credentials on the internet but they seem to be credibly claiming experience in this thread.)
I think if you feel like that’s happening to you the best strategy is to ignore it, but the second best is to prove your understanding. Explain with depth that can only be gotten from direct experience. If you know you know, either be confident in that or demonstrate it. I didn’t feel like you didn’t know what you were talking about though, I just thought you might be missing some nuance on the topic.
Here you go:
Part 1: https://twitter.com/christinaqi/status/1670221886587047941
Part 2: https://twitter.com/christinaqi/status/1670910949921005568
Part 3: https://twitter.com/christinaqi/status/1673621133885849600
Part 4: https://twitter.com/christinaqi/status/1676135720417910784
Part 5: https://twitter.com/christinaqi/status/1677359287172231168
The main aspects are:
On the trading side, HFT is mainly about what's called "market microstructure." These are relatively simple things that are quirks or features of individual markets. Things that most people don't care about, but can make a large difference in HFT profits include when an order comes in, who gets to trade with it first? How are orders routed between different exchanges? What are the popular types of algorithms that people who place large orders use?
On the tech side:
The main is minimizing tick to trade latency. This includes using techniques as basic as colocation at the exchange's (very expensive) data centers and as involved as designing custom ASICs and anything in between like bypassing the normal network stack.
Unfortunately the real state of the art things are all closely held trade secrets, but I'd start reading the exchange data specs to start getting an understanding of the microstructure side, and you can build some of your own experiments to see how quickly you can go from tick to trade. Can you get it sub 1ms? sub 100 us? 10us?
Most of these strategies are simple in concept but extremely difficult in execution. Many of them also rely on fine-grained understanding of the exchange's internal mechanisms, things that most traders would not know or be able to figure out.
I enjoyed my time in HFT, it is a fun game to play for a while, but stressful and ultimately unsatisfying as a career trajectory unless you are making serious cash.
1. Dark Pools, by Scott Patterson, and 2. Flash Boys, by Michael Lewis.
Dark Pools is better but doesn’t particularly touch on technical approaches.
https://www.amazon.com/Dark-Pools-Scott-Patterson-audiobook/...
https://www.amazon.com/Flash-Boys-Michael-Lewis-audiobook/dp...
https://access.redhat.com/documentation/en-us/red_hat_enterp...
On the techniques, there’s not a ton explicitly written unlike quant and statarb that have almost too much written about them. The essence is very simple though, you basically use techniques you would use in board games or casino games - look at the structure of the game itself and try to find little gaps in the rules that let you insert yourself. For instance if you can see the order being placed into the book before any march is processed you can try to insert yourself into the match engine before anyone else. That’s low latency trading more than HFT though. Likewise price discrepancies between exchanges (microwaves) is low latency.
HFT would typically be something like a market making strategy where you place lots of small orders around where you believe the market is going playing long and shorts. You place bazillions of orders all the time to pick up small variations in a way that on average is better than random trading. This is high frequency trading because the frequency of the trading is high.
Often they get conflated because they complement each other. Being able to do one often implies you can do the other, so why not? They also sometimes help each other synergistically.
Source: I was there (and I’m building my own as a side project with some long time coworkers)
I find it silly that math types gravitate so much towards HFT/quant trading when there's so much money to be made just by studying companies and becoming a traditional trader/investor. Why go to the bother going down the route of having to invest millions of funds to build an uncertain HFT business when there's no cost in opening a retail brokerage account.
If one lucks into getting a high paid HFT/quant job straight out of university it's great to save some money but otherwise I wouldn't recommend it except for pure engineers.
I got paid for the last 30 years. I didn’t do it as a way of investing. I did it because it’s some of the hardest technical challenges out there. I did a tour at FAANG, built my own startups, among other things. Now it’s my turn to do for myself.
Value trading works but it’s a slow slog and returns are bounded and tight. In many ways stat arb and similar quant trading can be viewed as value trading with power tools. It’s good stuff. But I like to make things fast and powerful. For me it’s not about being profitable, although profit is the primary metric. It’s about doing awesome stuff with awesome stuff no one has ever seen before.
1. Market making 2. Directional trading 3. Arbitrage
The tech is an enabler of these.
[0]: https://www.henricodolfing.com/2019/06/project-failure-case-...
If so, should there just be one stock market in the whole world, listing a small set of uncorrelated instruments, or is some level of competition/ variety healthy?
We haven't found any way to have those things without either HFT or something more expensive.
It's consistent and reasonable to take some kind of fringe anti-capitalist position and answer no on one of the first two questions, but if you answer yes, you end up with HFT providing value.