#25: High-frequency trading
by Tomasz Nurkiewicz
According to some estimates, even half of the trading volume in the American stock exchange is generated by computers. Specifically, computer programs that make trading decisions in a split of a second. They may buy stock to sell it a few milliseconds later. With very minimal profit, this process repeated thousands of times per day can make a solid return. How do such systems work? There are multiple strategies, but most of them require extremely fast algorithms running close to the physical stock exchange. The speed is crucial and that’s what makes HFT so interesting. A trading bot can easily read social media and within microseconds decide whether particular news is good or bad. That can lead to a stock going up or down. For example, a president tweets about a new special tax relief for the pharmaceutical industry. A computer program almost instantaneously buys some stocks from the pharma companies and sells them seconds later. Before other computers do the same. Human traders stand no chance.
Interpreting social media and other online sources is just one strategy. Another one is even more reliant on speed. Let me tell you a little bit how the stock exchange works. On the one hand buy orders are placed in a queue. On the other hand sell orders for the same stock are queued as well. Queues are sorted by price and when the buyer with the highest offer meets the seller with the lowest one, the transaction is executed.
Low-latency trading works when the same stock can be traded in two different exchanges. For example, New York and Chicago. When one trader wants to buy in Chicago and a corresponding sell order is placed in New York, we can execute a transaction. That’s of course when these two stock exchanges know about each other. However, when an algorithm knows about these two orders in advance, it can make corresponding orders locally. And make a little bit of many on so-called spread. How is it possible to know about these orders faster that stock exchanges themselves? Well, for example by communicating via lasers and microwaves, which travel faster than… well… light. Light in fiber optics, obviously, as opposed to ideal vacuum. Also, having a server closer to the stock exchange’s data center is important. How close? Well, it’s not uncommon to rent space in the buildings right next to the stock exchange. As you can see algorithms alone don’t need to be particularly sophisticated. However, they are super-optimized.
Some techniques employed by HFT are a bit controversial. For example, quote staffing requires flooding and quickly withdrawing a large volume of orders just to cause confusion and panic. Also, algorithms can make money where humans are simply incapable of. Our reaction times are several orders of magnitude slower. It can also be dangerous to the owners of such algorithms. Like that one time the company called Knight Capital got bankrupt in 30 minutes. A software deployment bug lost almost half a billion dollars in that time.
Stock exchanges must fight HFT algorithms. Well, maybe not fight, but make sure the market is fair. They are installing faster network connections. Time is synchronized with atomic clocks and GPS to support nanosecond precision. But the market is so big that investors are willing to spend even more in this arms race. Customized hardware and top-notch developers are working hard to squeeze every microsecond. And win against other machines.
That’s it, thanks for listening, bye!
- High-frequency trading
- Episode 763: BOTUS
- Has High Frequency Trading Ruined The Stock Market For The Rest Of Us?
- Software Testing Lessons Learned From Knight Capital Fiasco
Be the first to listen to new episodes!
To get exclusive content:
- Unedited, longer content
- More extra materials to learn
- Your user voice ideas are prioritized