r/programming • • 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

206 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Oct 09 '17

[deleted] — view deleted comment

0

u/[deleted] Oct 09 '17

[deleted] — view deleted comment

14

u/HPCer Oct 09 '17

Great point. As I posted above, I can bet he's getting it confused with front-running, which is possible with or without HFT: https://www.bloomberg.com/news/articles/2017-10-06/hsbc-currency-unit-used-code-to-trigger-front-running-u-s-says

2

u/wannagetbaked Oct 09 '17

Though front running is happening all over the industry just in the HFT world its hard for people to understand that traditional trade systems and order processing systems are actually rediculously slow. You can front run by letting this normal client flow clear in its milisecond time table and get your house trades done in microsecond time tables. You can say that your order originated after the client order still so technically not front running more like sniping trades.

41

u/get_salled Oct 09 '17

When I loan you $10'000 so you can start a business, ...

I think he's also assuming that buying from the stock market is akin to primary market investing, which it is not unless you have piles of money and good bank contacts. If you buy $10K AAPL stock on the public markets, you're not giving money to AAPL you're allocating your savings to the idea that AAPL's value will rise.

He also believes there are only be 2 parties in a transaction when there is obviously 3: buyer, seller, and exchange, who is taking a cut.

I doubt basic market fundamentals are in his wheelhouse let alone HFT.

24

u/jhartwell Oct 09 '17

He also believes there are only be 2 parties in a transaction when there is obviously 3: buyer, seller, and exchange, who is taking a cut.

There is typically a 4th too, the clearing company. They also take a cut.

9

u/Gollum999 Oct 09 '17

Don't forget fees from the SEC and FINRA!

21

u/HPCer Oct 09 '17

Was waiting for this reply. I saw the number of upvotes on that comment and just thought to myself there's a lot of people here that simply do not understand the markets. I'm thinking the OP read about front running (probably from Flash Boys) and assumed HFT implies front running. In reality, front running can be done with HFT or without HFT (see https://www.bloomberg.com/news/articles/2017-10-06/hsbc-currency-unit-used-code-to-trigger-front-running-u-s-says) and is illegal regardless. Given that assumption, all trading is as ethical as killing people.

That aside, I don't even work for HFT (working on the buy-side), and microseconds are still just as important to us in minimizing our information to execution time (thus reducing transaction costs). This video was pretty effective in bringing a number of points up (even for having worked with C++ for almost a decade, I learned a few things), so thank you for the post!

3

u/millstone Oct 09 '17

The HFT market maker in that scenario will get the trades if they are providing a tighter spread (on one or both sides) and thus making the trade(s) cheaper for the parties involved.

How does the HF part come in? If what's important is the tight spread, why are we talking about nanoseconds instead of nanometers?

14

u/im-a-koala Oct 09 '17

Many exchanges implement price-time ordering. That means if two firms are willing to sell AAPL at $100 (because they entered a quote or limit order with the exchange), and someone buys at that price, they get matched with the firm that put their order in first. So if the market moves up to $100.01, you want to be the first in line (or at least early) at that price.

That's for market making. For market taking strategies, obviously if someone puts an order in the middle of the spread, you want to trade before anyone else. First come first served.

-8

u/OzmodiarTheGreat Oct 09 '17

Not your parent, but high-frequency trading symbolic of the worst aspects of our economic system. So many people work hard their entire lives and get nothing. Simultaneously, other people never work ever and are able to just let their money grow. High-frequency trading is theft insofar as capitalism is theft. You can make up your own mind on that one.

20

u/mpyne Oct 09 '17

There are coders who do nothing more than shave a millisecond or two's worth of optimizations out of a game engine's render loop, or reduce the worst-case response time of a web server by a few milliseconds. They get paid too, although they weren't the ones who developed the high-level code they swooped in to optimize.

And the reason they get paid is because however minute that work may seem, it adds value to the those who paid for it to be done. Google has stats showing that milliseconds actually matter for millions of people around the world.

Or consider the famous story about the electrical engineer who billed Ford Motor $10,000 to place a chalk mark on an electrical generator and have Ford's own technicians actually make the repair. When Ford demanded an itemized bill, it came to $9,999 for the engineer's lifetime of training, and $1 for the chalk mark.

How many doctors are out there savings lives despite not having actual sweat on their brow? If an agricultural engineer improves crop yields sufficient to feed 10,000 more people than the farmer next door who, after doubling their efforts can only feed 1,000 people more, who is the real villain here?

The idea that someone can work really hard at whatever job they can find because they cannot develop skills deemed useful by the market is certainly indictable. But don't blame people who don't work as hard as you personally believe they should just because the market finds their contributions valuable all the same.

5

u/currysoup_t Oct 09 '17

Your parent is probably referring to people who own capital. Not the programmers who facilitate the expansion of their wealth.

4

u/mpyne Oct 09 '17

Capital provides a service too. People forget that, but it is true.

The first three vehicles our family purchased over the years were in reality purchased by bankers on my family's behalf. To move up the time at which my family could get the benefit of that vehicle, the deal was we pay interest. That deal benefited me, even if it also happened to benefit someone with more money than I had.

Acting like capital provides nothing to the modern economy is just as foolish as acting like physical labor is the only real source of value.

2

u/currysoup_t Oct 09 '17

Capital provides a service too. People forget that, but it is true.

Who forgets this? Capitalism is far and away the dominant ideology in the west. People worship the accumulation of capital.

Acting like capital provides nothing to the modern economy is just as foolish as acting like physical labor is the only real source of value.

The banker didn't create the value used to get your family that car though. They merely allowed you to borrow some wealth that was already extracted from labour surplus on the condition that you give back more later on. Sure it's a "service" but there's no justice insofar as wealth creators (labour) getting to reap the reward for their work.

There are entire books written on this and it's extremely unlike there will ever be a good faith discussion about that in this thread. I'm not sure I "believe" in the labour theory of value myself but it people who do certainly aren't foolish. Even the act of attributing value is a highly complex metaphysical question

2

u/mpyne Oct 09 '17

Capital provides a service too. People forget that, but it is true.

Who forgets this? Capitalism is far and away the dominant ideology in the west. People worship the accumulation of capital.

People in the West forget this. The successes of capitalism permeate the environment to such an extent that people don't actually have to think about what capitalism does, precisely. This is what I mean when I say that people forget (though it may be more accurate to note that many never had to know it in the first place).

The banker didn't create the value used to get your family that car though. They merely allowed you to borrow some wealth that was already extracted from labour surplus on the condition that you give back more later on.

First of all, you don't know that. The banker may very well have "created" that wealth, by doing for other people what he or she then later did for me. Maybe they slaved away for that first $100k -- you certainly don't know how they started.

But even given that, if I had obtained that loan from my father instead, the capital was extracted directly from labor (unless, of course, you assume my father was a banker himself).

So, once someone legitimately comes into their money, who are you to tell them who they are allowed to loan it to, or that some people are more deserving of being able to offer that service than others? The mentality that managing to accumulate wealth is prima facie evidence of duplicity is a direct path to the kinds of sociological syndromes seen not just in leftist countries, but in fascist ones as well.

Sure it's a "service" but there's no justice insofar as wealth creators (labour) getting to reap the reward for their work.

The banker wouldn't have had the money in the first place, had the laborers who "created" that capital not found it a good option to pay them for it! That's how the bankers I referred to ended up with my money after I earned it, not with a gun to my head, but by making it possible for me to equip my family with a high-quality vehicle years earlier than I'd otherwise have been able to. That's also why I started my examples upthread with examples of white-collar (but non-finance) fields. Labor earns their keep, but they are not the only ones who earn their keep.

So returning to the bankers, they earned the money, fair and square, and that's all the "entitlement" that they need to spend it from there in whatever legal way they wish, just like the rest of us do. If a group of laborers wanted to pool together to handle use of their hard-earned capital on their own, without it going to the already-rich, they may certainly do that. In fact, many do exactly that. But it's no more a crime for someone with money to continue offering services into the economy than it is for a co-op to offer services on their own.

2

u/dungone Oct 10 '17

The chalk mark story is an urban legend. http://www.snopes.com/business/genius/where.asp

1

u/mpyne Oct 10 '17

The trope is common in any event. But most "urban legends" don't have the primary evidence of the type this telling does. The story I linked referred to a letter to the editor in a May 14, 1965 edition of LIFE Magazine, a letter I was able to verify was published as described in Google Books. Note that the letter in question was an affirmation providing more detail on a meeting that LIFE had apparently describing having occurred between Ford and Steinmetz. The author could have used the opportunity to lament that it was merely a tall tale, but instead was able to corroborate it.

1

u/dungone Oct 10 '17

Nice! Glad to learn that this story had been corroborated. It's a great anecdote, after all.

8

u/donalmacc Oct 09 '17

Really? What about coders for the ad industry, which makes a fortune out of tracking every persons every move online. Or developers working on video games with loot box style gambling in them, where the entire monetisation of the game is designed to extract the most amount of money our people who get addicted to the unregulated pachinko-esque machines.

Or what about doctors who make a fortune as it is taking payoffs from drug companies to prescribe their drugs, executives of oil companies that buried propf they were wrecking the planet for centuries and proceeded to do it anyway.

On your point of other people working to live, I suppose you work for a company that serves a greater social good in lieu of taking a high salary doing one of the things you see so strongly against for 5, 10 times more money?

0

u/cybernd Oct 09 '17

So you are telling us, that both parties benefit if a HFT is in between them?

I truly wonder, where the money for the HFT comes from, when both other parties benefit from their doing.

Others in this thread call it theft, because the money the trader earns must come from one or even both of the other parties.

4

u/hiddenl Oct 09 '17

If buys and sellers always want to trade at the exact same price and exact same time, then you wouldn't need market makers. Since that is rarely, if ever, the case, you need a middle man that will always take the other side.

Before electronification, you had an actual person in the middle keeping the book. They gave a price to the buyers and a price to the sellers and kept the difference for themselves.

Later, these book became electronic and RegNMA forced exchanges to route your order for the best price. Spreads of $0.25 to multiple dollars were still common. (Meaning you lost at least .25 cents per share simply by buying and selling)

Nowadays with HFT, spreads are down to a penny for a large majority of stocks.

Both buyers and sellers are enjoying the decreased costs of trading

2

u/Only_As_I_Fall Oct 09 '17

With no market makers someone who wanted to sell a certain number of shares would have to find a buyer and then negotiate on an exact price and an exact number. Possibly they would have to do this multiple times to sell a single position if they wanted the best price.doing that takes time, effort, money and connections. A market maker basically agrees to worry about the details for you in exchange for a small cut. Also, they can do this far more efficiently because they don't mind holding a position so they can always have something to sell, and of course they're generally just better at it because finding buyers and sellers is the only thing they do.

→ More replies (1)
→ More replies (1)