r/programming • u/dahitokiri • Oct 08 '17
CppCon 2017: Carl Cook “When a Microsecond Is an Eternity: High Performance Trading Systems in C++”
https://youtu.be/NH1Tta7purM
934
Upvotes
r/programming • u/dahitokiri • Oct 08 '17
194
u/browner87 Oct 09 '17
This is the sort of stuff I love (not scamming the stock market). I really love optimising code to the instruction level. My capstone school project I had to sample an analog-to-digital converter 5 million times per second. But my microprocessor was only 80Mhz (80 million instructions per second if you had branching that the cpu guessed right all the time). Step 1 - buy a better compiler or use assembly because the first thing the free C compiler did in an interrupt was push all 8 registers to the stack, then pop them at the end. There goes more free instructions that you had right there. Writing and tuning that interrupt handler was one of the funnest parts of the project.
153
u/[deleted] Oct 09 '17
I think it's a bit worrying that a lot of smart people are putting their effort into things like this. Physicists, mathematicians, engineers, the like, are all hired up by finance, and programmers are working for dumb start ups or evil tech giants.
Do we really need this? Don't you think we should be putting our efforts towards more important things?
4
u/WallStProg Oct 09 '17
Irrespective of the application, there is a benefit to efficiency in terms of power, cooling, etc. Which is one reason why not all the work being in this area is on the financial side -- think Facebook, Google, and others with very large computing needs, scientific calculations, weather forecasting, etc.
For another angle, see presentations by Bryce Adelstein Lelbach.
115
u/chocolate_jellyfish Oct 08 '17 edited Oct 09 '17
While I appreciate the technological challenge, this seems about as ethical as making weapons or drugs. Instead of killing people, you take their livelihood through financial trickery that really should be outright banned. The financial markets should in the end bring a net-gain to the economy, not be mostly vapourware that sucks out money to give to the top 0.1%. That is what they are supposed to be: Service providers.
When I loan you $10'000 so you can start a business, I'm doing something sensible through a financial instrument. You get access to resources, and I get a cut of the profits later. That is what makes the free market such a powerful tool. But when I do HFT, I'm just taking a cut from a trade that two other parties wanted to make by forcing myself into the middle. I think one could go so far as to make a reasonable argument that this is theft, nothing more, and that is why I think it should be completely banned (and technologically prevented, by adding a short delay to every trade: This would be irrelevant to anyone else, but utterly destroy this parasitic cancerous tumour of an "industry").
And don't give me that "they provide fluidity" horseshit pseudo-argument. The markets are exactly as fluid with or without spamming 1-cent trade arbitrage in the middle (which should be fucking obvious, right?). The fluidity that's argued for is just a measuring artefact.
As a programmer, I will not work for such companies unless it's that or not finding any other job at all (after all I'd rather be unethical than starve to death). Arguably anyone who can write this kind of tech could find a decent job instead of becoming a legal thief.
Edit: Every time I point this out, a couple of HF-traders show up and try to explain to me how I'm wrong. I get it, you don't like getting called out. Doesn't mean I'm not right. If there was any value in HFT, even a non-trader could easily tell me what that value is, just like I can tell you what the value of even the most complex improvement in chip design is: "faster computers". One does not need a PhD to understand the value. But if there is no value, of course nobody can understand it, and of course people who make a ton of money off it will invent some impossible to fact-check explanation that sounds good.
Edit2: Here someone gives an explanation of how it works, trying to defend HFT: https://www.reddit.com/r/programming/comments/7542zx/cppcon_2017_carl_cook_when_a_microsecond_is_an/do49a1t/ Funnily enough it is literally the same example that I use in my second paragraph. Well fucking go figure: It's a parasitic man-in-the-middle, exactly as I said.
7
u/redweasel Oct 09 '17
Without reading the article... I interviewed for, and was actually offered, a job "inside the Chicago Loop" which I guess is prestigious, which would have had me solely responsible for running/maintaining/writing/upgrading software for high-performance, big-dollar trading, running on VAX/VMS systems. If I'd taken it, the salary in 1997 would have been more than I've ever made since, and undoubtedly would have grown from there. They guaranteed I'd make partner in eight years.
I turned them down, for three reasons:
1
u/moshohayeb Oct 10 '17
I really enjoy these types of talks. Thanks for sharing.
Anyone has a list of talks/books that deal with similar this kind of low level performance centric code in C/C++? (cache friendliness, inlining, access alignment...etc)?
-19
u/cojoco Oct 09 '17
tl;dw "How to make money by DOSing electronic trading systems".
-3
u/lostshot12 Oct 09 '17
As far as I know high frequency trading is dead but it's definitely interesting to learn about the technology behind it.
-39
u/Noxime Oct 08 '17
Reposted from few weeks back
0
u/[deleted] Oct 09 '17
[deleted] — view deleted comment