217 points · by mraza007 · 6y ago · 214 comments
Being 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++”
https://www.youtube.com/watch?v=NH1Tta7purM
Core C++ 2019 :: Nimrod Sapir :: High Frequency Trading and Ultra Low Latency development techniques
https://www.youtube.com/watch?v=_0aU8S-hFQI
Open source Java HFT code from Chronicle Software, https://github.com/OpenHFT
"Writing and Testing High-Frequency Trading Engines", from Cliff Click
https://www.youtube.com/watch?v=iINk7x44MmM
However in these domains every ms counts, even how long cables are, so also expect Verilog, VHDL, and plenty of custom made algorithms running directly on hardware.
"A Low-Latency Library in FPGA Hardware for High-Frequency Trading"
https://www.youtube.com/watch?v=nXFcM1pGOIE
You can get an overview of the typical expectations here, https://www.efinancialcareers.com/
Do you have any good sources for information about this concept? I'm having trouble understanding how a algorithm could produce useful work without allocating anything.
They don't allocate any new memory but they do perform operations on an input and write it to an output. At least in the embedded world this is how this is often done. Considering the overlap between embedded software and HFT, I'd imagine most of these algorithms are going to be something along the lines of "Take in a massive but fixed size block of read only data and output a fixed size result." You can have allocated memory but it needs to be allocated at startup and be able to be consistently reused without need for reallocation.
If you want super low latency, the last thing you want is a memory allocator blocking in the middle of your highly optimised algorithm. Instead you allocate everything ahead of time and just reuse the memory over and over again.
You still have to have memory and use it though, somewhere.
I interviewed at a Manhattan HFT firm (~2015) and that's what they do. The boss noted that "Congress could make a law invalidating our business model" and I realized that would be a good idea. They're not making the world a better place; they're not providing a valuable service; they're just exploiting and extracting and skimming some dollars out of the market. They have money and they're in the right place so their money can grab more money.
The company was run by car salesperson types.
And their clients were even more sleazy. One of the popular joke they repeated with clients was that everyone is unhappy, and if they are not, then they haven't seen the right ad.
It was pretty amazing to see "startup" founders come in and say they want to make the world a better place. Then say they need to target stupid people because they spend the most money. Or only an idiot would buy their crap but there are a lot of idiots.
A lot of subscription services are started by rich stay at home spouses. Many of them didn't even really care about about making money but just wanted it as a status symbol and a way to get their pictures appear in their friend's feed. It was funny how wanted to make sure their friends saw their ad, even though they knew their friends will never buy whatever.
After working there for a year, I decided I will never deal with anything remotely related to adtech. Professionally, I am not yet fully removed from adtech. Stuff I work on now is indirectly used by adtech companies.
But I used to spend a lot of time making websites monetized with AdWords. Now I do algotrading as a hobby and feel a lot better about it. There are no false pretenses. It is just about making money. Honest, pure, simple. And it is challenging.
So I would say ads are definitely a lot worse.
They're also (belatedly and sometimes decreasingly) heavily regulated in most of the world. What they do isn't always rent-seeking.
How could "making people click ads" be worse?
I don't think anyone on hacker news would bat an eye if your comment said "Ads are problematic" before this sentence.
It's also unclear to how HFTs are eavesdropping on anyone, they use publicly available (for a price) data.
> I don’t want to live in a world where someone else makes the world a better place better than we do
"Making the world a better place" to me has the connotation of providing a small positive contribution for others around you.
Is the immoral part that they can use their money to make more money? If by earning more money, one can afford to buy more food in bulk and save money on that and gas, or buy a washing machine and save money on going to the laundromat, is that immoral of one to do?
Something that I have heard is that they are providing a service by providing liquidity to the market.
They aren’t making things worse, lower transaction costs are good for everyone that participates in markets, which includes the OP.
> [Jim Barksdale] spent an estimated $300 million or more to bury a fiber-optic cable that shaved three-thousandths of a second off communications between New York and Chicago
The arms race is a necessity due to rising competition. HFTs cannibalize each other every year. People on the outside seem to think being in HFT inherently means you’re printing money but they don’t acknowledge how tough the business actually is. Many firms have either collapsed or have been bought out over the past decade.
Market makers specifically (who inherently have to operate in HFT time horizons) don't even compete with low-mid frequency hedge funds and props. They don't compete with retail investors. They strictly compete against other MMs to capture the spread.
Most people would argue that they are not directly making the world a worse place, but rather that they are sucking in talent that could have used their skills in other places to make the world a better place. For example, many talented Physicists ended up in trading companies a few decades ago. Today, you can make a similar argument for companies such as Google or FB who probably have tons of extremely intelligent scientists working on ads.
> Something that I have heard is that they are providing a service by providing liquidity to the market.
It's unquestionable that they provide liquidity, at least most of the time. That's good. What's questionable is whether they are doing it in an efficient way. Their primary goal is not to provide liquidity - it's to make money. Liquidity is just kind of a side effect of their activities, which is an elaborate race to "beat" other firms through speed and algorithms. Most of the resources go towards that, but don't result in additional liquidity, most of which is probably not even needed. It's like saying "FB provides an important service by allowing you to message your friends" - sure, that's not wrong, but that's not their primary goal. And you don't need a trillion dollar to make a messaging app. The difference is that FB also does lots of other things, so it's unclear how much of their resources are actually wasted vs. potentially used for "making the world a better place" - it's not quite as obvious that they are wasting a lot of talent and capital.
The other question is what the alternative would be. Markets run by human traders were significantly more unfair than anything we have now, but HFT was never meant to happen, it was just result of markets becoming electronic and transparent, and people trying to extract more money.
Sounds like a typical entry-level job to me.
> They're not making the world a better place; they're not providing a valuable service; they're just exploiting and extracting and skimming some dollars out of the market.
Firms providing useful services through their trading allow our economies to prioritize resources more efficiently. Better resource prioritization increases prosperity, which makes the world a better place in a multitude of ways. The useful services provided (for example, increased market stability) go beyond the seemingly-simple benefits of "increased liquidity" and "tighter bid/ask spreads" that are often mentioned. This becomes easier to appreciate once you delve into the enormous number and diversity of traded instruments and their interrelationships. It's far more than just cash equities.
Firms pursing parasitic trading are harmful to markets. Their behavior tends to backfire in the long run due to a combination of regulatory action and natural market dynamics.
Characterizing all (or even most) HFT firms as harmful is inaccurate in my experience.
It's pretty/very rare for malicious code/data to get involved because this sort of thing is almost always co-hosted with the exchange. There's nowhere really to inject yourself. I'm sure it happens in other parts of the process, just not much in the very low latency parts.
[0] https://en.wikipedia.org/wiki/Knight_Capital_Group#2012_stoc...
I ask because a friend was contacted by HFT firm but is concerned about work hours and cowboy coding.
Everybody's talking about what it takes to write trading systems, but OP asked about "skills required to land a job" not skills needed to do the job. Aside from a few specialized roles (like FPGA dev or security), the firms I'm familiar with only evaluate general dev skills. The interview process is pretty much the same as you'd experience at a top tech company. They don't care at all if you know the languages they use. Once you're in the door, the firm will teach you everything you need to know.
Firms like this also employ a wide number of third-party recruiting services and internal contractors, I know at least one. If you can impress one of these third-parties you can get in the door without a degree from Stanford.
It's true about not caring about if you write whatever language that they do - what I've found is that most firms are generally interested in your combined intuition for markets, math, and analysis. If you "get" market mechanics, have a solid grasp on mathematics, and have the creativity and skills to apply those skills in an innovative way, they could care less what your primary programming language is.
For example, if you have the market intuition to understand the common underlying drivers between RBOB gas and WTI crude, are creative enough to come up with a new form of analysis, and have the math skills to take that idea from conception to delivery, they really don't care if you have to learn CPP to integrate your intelligence and creativity into their infrastructure.
Source: Work in/around the industry building data processing for trading firms, funds, etc. Also received a couple of prop shop offers.
For dev roles, Python experts (emphasis on expert) and experts in modern C++ have the easiest time. C experts and systems programmers with assembly expertise can also find a job, but the market is smaller for them (although higher-paying).
OS-level and systems programming are valuable. Understanding computer architecture is important, and computer systems as well.
Credentials are an important filtering mechanism for them, so if you didn't go to a top 10 school, your resume needs to make up for it (or you need to be a very experienced hire). Working at a FAANG company or a bank doesn't necessarily make up for not going to a top school.
Successful devs at HFTs usually have a ~50-hour workweek or are very efficient programmers.
Cleanliness and design. Learning and using language features that make code easier to build on, test, and deduce about. Basically writing code that's very nice to humans. Here python really shines.
The second part is writing code that's very nice to machines and runs really fast and correctly. Multiprocessing, writing parts of the code in a compiled language for extra speed, using buffers for speed, async, that kind of thing. Easy enough for specific problems, the issue is that these performance tweaks often make code harder for humans to understand.
Now writing a nice looking and well designed program is fairly easy. Making a really fast-but-ugly program is also fairly easy. The mark of a real expert in my opinion is combining these two abilities: writing code that's both human and machine friendly. As always, practice makes perfect.
To practice you need to practice both, and on real data. Don't just use toy examples, get your hands on some big messy data that takes hours to crunch. Don't just write toy apps, keep writing and adding features until it becomes a huge stinking mess, then learn from that mess and do it again.
I was writing spaghetti mathematica code and had a poor linear algebra understanding when I wrote up an implementation of the concepts in Ganapathy Vidyamurthy's book Pairs Trading. It was terrible code that was 1200 lines of procedural, no functions, no objects code, but they could see that I could hack it when it came to the math, could learn on my feet, and had the drive and creativity to work out problems put in front of me without a ton of handholding.
The additional benefit there is that I got to come in and talk about something that I built and knew intimately during the interview. When they asked me about my Kalman filter implementation I could speak knowledgeably because I built it, the differences between other forms of hedging ratios because these were considered in the book that I'd had to pound into my head. It seems a bit scary to put your work in front of these people with advanced degrees from universities that wouldn't even respond to your application, but it transitions the interview from being asked questions at random to talking about something you put six months of effort into, even if it it kind of sucks too.
I think it's the same as becoming an expert at anything. Lots of practice, and lots of feedback from people who are already experts. The latter is unfortunately pretty hard to find unless you already have a job writing Python.
It also helps if you write a book about it ;)
And it turns out that kids from Ivy League schools tend to be very good at constantly being aware of these top-level priorities for the firm. This applied for almost every front and mid office role in that firm: DevOps, algorithm developers, traders, researchers. I can't speak for all the firms out there, but I think at least my friend would happily substitute pedigree for another item on a person's resume that demonstrated experience with running a live system where downtime is very costly.
Where I work, our devops use a mix of python/ruby/golang/bash for day to day debugging and development. Ability to read, understand, and modify Python (or a similar scripting language) and a familiarity with Bourne/bash are probably the minimum for devops.
For operations, you'd want to bring some skills that add to the team in new skills or redundancy. You'll likely be trained/cross trained in many more. Familiarity with and ability to debug some of the following: databases, networked services (sometimes a pcap replay is all you have), systems troubleshooting, monitoring, queues, or specific hardware and software platforms we use.
At the HFT I work at, we hire Jr and Sr people. For systems people, there is a bit of a divide between trading systems engineers, who work directly with devs and traders on the care+feeding of some corner of our software stack and infrastructure systems that provide shared tooling and substrates (k8s, deployment tooling, continuous integration/delivery, configuration management tooling, additional debugging help, etc). We also have network teams, traditional IT service desk teams, and performance monitoring/improvement teams.
If you're not coming from trading, we still need all of the standard sysadmin and devops skills. We have SSH, Kafka, Zookeeper, MySQL/Maria, tcpdump/wireshark, Linux, Puppet, Docker, Kubernetes, ElasticSearch, Hadoop, etc. We have misc custom file formats but also loads of json , some xml, etc. We integrate open source and proprietary as much or more than we build. Outside of the execution stack, you'd recognize a lot of what we do at any medium-sized tech company.
If you want to talk about life at an HFT, my email is in profile. I came into HFT as an experienced hire from the startup world and currently do builds development.
https://www.virtu.com/careers/ has a devops role listed within the first 10 results on their careers page. It looks like basically any other modern ops job sheet.
Here is one for DRW https://drw.com/careers/job/1280794 again, not much different than any other firm.
Most software written at trading firms is the same as software written anywhere else. The only real differences are on the actual tick to trade path, where you will see the need for FPGA/ASIC programming, very low level network programming and C/C++ systems programming or on the Quant side which can vary widely but typically involves showing PHD level research skills in some hard math/science.
In such a scenario, is the 99th percentile of quant compensation significantly higher than the 99th percentile of tech company compensation (FANG etc)?
I've always considered this a fork in the road for many---finance versus say advertising--and I'm curious how others with more experience would describe the pros and cons of each.
HFT shops do indeed pay more. Perhaps at the top percentiles they're similar but at the median, HFT probably pays double, and it's cash, not RSUs that vest over many years. The downside: culture of always in the office (not sure how covid will affect this), software that is insanely specialized and uninspiring, and generally awful work/life balance. I'm sure some shops are different, but they expect you to put in a lot of time to earn that salary. Compared with FAANG where the burn-out is at little more prolonged (and of course the morally dubious business that is ad-tech).
I've learned to stay away from both and have never looked back. But I think working a FAANG or HFT is a good thing for any dev to at least look into while they're young and ambitious and can "afford" a bit of burnout to see what life can really be like (or not).
Prop shops seem to have a pretty strong understanding of ROI in all things, including time spent, so if your killer strategy just doesn't have a ton to act on today go take an hour lunch and head home or wherever. The place I was at was known as an "arcade" or a bunch of unrelated strategies from various teams that happened to work out, so maybe it's different other places, but I can say for certain that I've done 90 minute lunches off site with senior traders in the middle of the trading day just because the volume in their primary product(s) was mostly just interns throwing 1 lots at one another.
Because I can work in a very chill environment and earn 200k-250k + stock. I can also work 60 hour weeks for 300k + bonus.
I used to work in London on roughly $180k putting in about 20 hours per week.
This is the big question for all of Wall Street right now. So far it’s not been too bad but there are gaps here and there.
Is there anything in particular you did to switch? Any specific tech skills you picked up? Or did you just apply and do normal interviews?
I've mostly stayed in ads because I'm really good at JavaScript, and a huge chunk of ad optimization/tracking is on the frontend.
The best thing for getting hired, unfortunately, was my degree (math+finance @ Oxford). Recruiters chased me! I don’t care about the degree, but they do - not necessarily people who interview you, but HR/recruitment department, they use your pedigree to float your CV to the top of the pile
Also interviewing is huge hit and miss. I got rejected by like 5 companies in a row (often initial rounds), then got 2 offers at once (and one of the companies said I was one of the strongest candidates ever).
You explicitly go to Google, Facebook, some website. No one is pushing ads to you PC without you making a request to.
I mostly dislike ads and adtech, because their value is overstated. However... You aren't entitled to stuff that people publish. Thus placing an ad blocker when visiting my site, you're being an asshole.
Would you pay Google $500 per year for all of their services? Then $200 to Facebook. Then your local news portal another couple of hundred.
Would you be willing to share the name of your firm, and more generally your experiences, here or in a unicast channel?
Avoid both and Choose to make a difference in people’s lives.
The best he can do is not actively make anyone else’s life worse, so go with finance, and adopt a shelter animal.
Based on what? Anecdotal, but my partner is a data scientist and statistician full-time . She regularly volunteers or contracts her skillset to a range of projects, including medical research and criminal justice. It's very impactful work - some of the research will massively improve people's lives. And there is definitely enough work to mostly focus on those projects if someone wants to.
> What are the implications of identifying a scenario where there is no race condition?
No race condition? Great. It's totally possible there are some not-so-concurrent parts of your software that can run in what I deem a performant manner.
> Does it just result in a performance hit?
It's much more than that. A bug I have is very serious and it goes something like this: you set a limit order to buy X shares. The limit order gets a partial fulfillment, and you immediately set stop losses and take profits for X shares. However, the limit order gets complete fulfillment before the two other requests are done. If you now try to update the previous orders, for example, it might be that the update call gets registered at the broker first, but the creation gets there last, which means you have bought X+Y shares, but you have stop losses and take profits for only the X. You might now completely lose Y unless you monitor the software all the time. Things like these might happen everywhere, and the real trouble starts when these instances with plausible race conditions of their own start communicating with other parts which might also have race conditions.
And the requirement for the concurrency is not only a performance: you might want to collect data in thread N, while you have different strategies of amount M, which all by default subscribe to N, but only selectively when they are doing their strategies. In such a sense, I don't think that doing even a semi-serious trading software without concurrency is possible.
Go for example has a race condition detector built in to the tool chain (go run/test/build --race). They won’t tell you how to fix it, but they’ll tell you which lines are in the critical region that the programmer missed.
Briefly, the faster your execution the faster everything else needs to be. Java should be fast enough for almost anything short of HFT + colocation which is super expensive infra wise.
The skills are not different from other backend roles, but you will need to exercise more math with emphasis time series and stats.
If you want to work on the trading systems, you should be good OS-level and network-level things. And you should probably know C/C++. I think some firms might still use Java.
Good firms have probably been around for a couple of years, so it's unlikely that they'll use the cool new languages of the day.
Rust has some benefits (and still integrates reasonably well at the ABI level), but modern C++ compilers are no slouches. Rust provides a friendly dev experience, which is a valuable thing, but a lot of the ecosystem advantages are old hat at companies with mature codebases.
Just curious to find out
Reference: https://code.kx.com/
This is a joke right? Unix is not even a solved problem and it's been around 50+ years.
Operating Systems: Three Easy Pieces (free online) - Arpaci-Dusseau
Linux Device Drivers, 3rd ed (o'Reilly) - Jonathan Corbet
The Linux Programming Interface - Michael Kerrisk
The Design and Implementation of the FreeBSD Operating System (2nd ed) - McKusick, McKusick, Watson
Solaris Internals - McDougall, Richard, Mauro
A High Performance Inter-Thread Messaging Library used for HFT.
A lot of work and skill went to memory layout (minimize cache missed), lock free data structures and spending time in perf looking for ways to shave microseconds off a function.
God knows how I got the job, I was super junior , but that’s the kind of work we did and presumably what other companies would want you competent with
With that said, FIX is still relevant on many exchanges and in wide use by the broker/dealers etc...
Every other student there had (to me) a shockingly naïve understanding of software engineering, and many of them were done with school at this point, and had interned at big companies... 90%+ went to a school like the one you mentioned, and started looking through me when I shared the school I went to.
Maybe HFTs and hedge funds feel they need to hire from these schools, because they assume that the pool of candidates outside of these schools is even worse?
The actual engineers I spoke to were either very bright but kind of self conscious that they were “marrying down” for money, or very excitable and coming from non-eng backgrounds (physics, etc).
Can someone correct me if my impressions were wrong? I don’t want to name names, but these were two pretty successful companies, one was a Hedge Fund and the other was an HFT firm.
Generally speaking (so obviously not for everyone - but for most) working as a developer in trading was not anyone's first choice. Go figure what this means for the kids from brand names schools who end up working there. I say this is as someone who went to work at an HFT firm after MIT.
It is true that HFTs are more easily accessible to top schools but that's largely due to employee alumni networks and HFTs sending recruiters to school mixers and competitions. We sponsor competitions/hackathons at places like CMU and MIT (and send recruiters/reps to network/scout). If you go to $StateSchool, just apply through the usual channels (check websites for internships/graduate roles). If you can pass the automated tests, you'll get a phone/video chat screening.
Source - got an offer from Citadel previously without a top school or C/C++ expertise.
There was a paramedic on the trading floor. At least once a trader had a heart attack and the other traders were just casually stepping over him post-collapse, because... paramedic on the trading floor.
It was my first job post-college; in the first or second week I was there, a company wide email went out that stated the policy for in-office birthday parties was being changed in that strippers would no longer be reimbursed. Out of office it was still ok.
Anyone interested in those times should read "Liar's Poker"; it's a good overview, at least from what I remember, since where I worked was that same firm.
Fresh grad devs are generally evaluated on their potential and not what languages and specific skills they know. The people they end up hiring for fresh grad dev roles tended to come from the same six schools. Said schools are generally not top tier (for developers) and are local to Chicago.
https://www.hudsonrivertrading.com/careers/
Looks like c++, python, and linux sysadmin stuff.
I'm not very familiar with the HFT industry, but the skills that they require (C++, computer architecture, OS, networking, & performance) are ones that I'm interested in and would love to deepen my experience with. Are there companies on the west coast (more specifically southern California) where one could develop this experience?
Maybe I'm sour-grapes, but I got pretty far through a HFT loop only to get turned away because I didn't have any experience with the particular boost library they were using. (A library that will be mostly obsolete by C++20) They said that this was common in the industry.
Brave of you to assume they'd be able to use C++20. Unfortunately HFTs are just as susceptible to "stuck on an ancient version of GCC" as any other C++ shop, so maybe you dodged a bullet there.
On the quant/research piece, python/R/kdb are common tools used, but the real skills are the statistics/math and market knowledge.
Trading Systems - C++, networking, memory management.
* I work at a HFT firm building algos for clients
I think OP is asking about programming skills implying automated, systematic trading and algorithmic execution on exchange traded products.
zmq/java - lmax
then there is forex c++ mt4 metaquotes
more hardcore like cheetah-solutions fpga / hdl
don't know about asic
some insides but now inactive https://mdavey.wordpress.com/
there are also options / stocks and cryptocurrencies
But they'll teach you everything you need to know as long as you can pass the interview.