Rise of the Machines: How computers took over the stock market
Inside the super-secret world of algorithmic trading
"Other Wall Street businesses are about low-frequency analysis or customer service or having a particular network of people that you know," says Charles Jones, a professor at Columbia Business School. "HFT is really about the IT."
In the late 1990s, firms would use the best hardware money could buy, but eventually they started to outrun the capabilities of these platforms. Today, HFT firms may pay less for base hardware, but will spend a ton on the expertise required to write its software (and the pricy colocation fees with the exchanges).
"In '93 or '92 we were one of the first one firms in Europe having an electronic trading machine on the Deutsche Borse - back then we spent half a million euros for a computer. For half a million euros in hardware you can buy a mighty big machine these days. Even FPGA - they cost you 10,15,20,000 euros max for the card - the rest is intellectual property. The hardware buy itself has come down hugely in price," says Peter van Kleef, manager at Lakeview Capital Management Service.
As things got faster, traders moved from Windows to Linux, then they started doing kernel hacks within Linux to cut the footprint of the market data processing, and that worked for a while, and then even that got too much.
"Soon some traders said 'Well heck, why am I even putting this on the OS, why not just do it all on the card?'," Lightspeed's CTO Ignall says. This sentiment bought around the use of application-specific integrated circuits (ASICs) and then field programmable gate arrays (FPGAs).
"Every time you do this you become more specialised [and] your product becomes more inflexible," Ignall says.
But specialisation can help traders shave milliseconds off of trade times and maximise their advantage. This is hugely important when your trading engine is competing with others in a stock exchange. The LSE, for example, boasts about the 125-microsecond latency on round-trip trades through its platform. Any time spent not hammering the exchange at 125 microsecond increments with quotes or trades represents potential lost revenue.
"To use very loose terms, being able to process [market data] quickly requires that that data is stored in the appropriate parts of the machine that can be quickly accessed," high-frequency trading firm Tradeworx's chief strategy officer Mani Mahjouri says. "The problem is your standard production-level server isn't really designed for this type of application.
"The design choices made in chips today and architecture of how these systems are laid out aren't optimised for this type of behaviour," he adds. "Those limitations can be overcome using customised products and customised products make sense in that scope."
This is where FPGAs shine, as they let you create a custom bit of logic to run your trading algo. "The primary benefit of FPGAs and things like that is throughput into the system - being able to read and digest the market data that comes with these exchanges," Mahjouri says.
This lets you remove much more latency, but is also expensive,as it requires you to hire people with major hardware expertise along with people versed in the esoteric world of programming computer logic.
"The best algorithm is dead simple, otherwise you can't really run it on an FPGA," says Lakeview Capital's Kleef.
We also understand that some firms use other non-standard chips along with FPGAs, like RISC-based chips from Tilera. Like FPGAs, Tilera's chips are being stuck into network cards and used to process and act on data.
"We can get about 1.7 microseconds of latency from wire to wire," Tilera's director of marketing, Bob Doud, says. "We believe they're using our card for more than just the NIC. They're probably using some intelligent methods of delivering PCI bus data to the host – you can do things like direct data placement, bypassing the kernel, writing directly to the cores."
As with cloud computing, the trading engines and algorithms used by HFT firms are considered key competitive technology, so getting these companies to open up is difficult. However, just like cloud computing, they may be be more similar than dissimilar, with vast quantities of money lying in the minor details from algo to algo.
"I think most of the algorithms are very similar - probably a couple of dozen strategies that are well established over the years," Lakeview's Kleef says.
HFT job adverts typically ask for C++ and/or Java skills, along with a familiarity with Unix systems. Adverts we've seen list skills as varied as Java (J2SE), multithreading, garbage collection, GC tuning, concurrency, and low-latency, along with the use of technologies like Spring, Hibernate, and Maven.
There is also great demand for "quants" (quantative analysts) – which are the people who write the algorithms that create the data mining models used in these fantastically fine-tuned trading engines.
"We personally target PHD level, post-doc level candidates in the hard sciences, like physics," high-frequency trading firm Tradeworx's chief strategy officer Mani Mahjouri says.
What all this technology allows firms to do is create trading platforms that let them execute buy and sell orders in as low a time as possible.
Blink and you'll miss it
"If you think about time in the securities industry, time is risk," explains Frank Hatheway, chief economist for NASDAQ OMX. The goal of HFT is to get between the major institution buyers and sellers to 'capture the penny'," he says.
"The point of this is there's very small amounts of money in an arbitrage project and you just do it again and again and again," Hatheway says. "Once you have software that's sophisticated enough to do this, the ability to scale it is so much greater in an electronic environment than it was with a clever human who could do one or two or three stocks, now you can deploy a clever algorithm across 100 stocks, 1,000 stocks, 2,000 stocks, and potentially deploy it globally."
In many ways HFT is not unlike the Wild West – if you've got the fastest reaction time, then you'll easily beat others. The firms that can react the most quickly to trades set the pace for the market and therefore can take the largest profits and minimise their losses.
"If you know you're the fastest one then you can have considerably less code," Nanex's Hunsader says. "You can get away with a lot if you're the fastest one there."
By example, if you're the first to get trade information, and have a trading engine that means you can also analyse and execute your trade quickly, then if the market turns on you it's possible to unload your shares at the highest possible price, and there's a chance that the slower robo-traders behind you will still buy at an inflated price from you for a few seconds until their computers recognise that the pricing change has occurred.
"A lot of algos will follow other algos," Hunsader says. "As long as you've got somebody following you you can dump off your position."
By dominating trading in single markets, high-frequency trading firms can minimise their risk and maximise their profits.
The huge technology demands, combined with the large amounts of trading capital needed to bankroll the vast pace of trading, mean that barriers to entry for upstart firms are very, very high.
"It's really an arms race in the sense you're going to want the best, the fastest," Ignall says. "No way around the fact you'll need to outspend the next guy. If you're trying to be the fastest you have to get the best hardware."
Lightspeed's point has been repeated by all of the sources we've spoken to.
"This whole thing is one giant arms race," Doud says. "It's the guy who has the best equipment."
After talking with many sources, we've heard there are probably around eight HFT firms operating in America that take the lion's share of the market. "Right now we're trading US equities – trading about one per cent of the equity market volume daily," Tradeworx says. The company also sells its tech to other firms as well, and this means its trading technology handles around 5 per cent of US equities alone. "Two hundred to three hundred million shares a day," Mahjouri estimates.
But for all its advanced technology, qualified staff, and direct link between developing clever tech and making tons and tons of money, high-frequency trading is prone to mistakes that wipe billions off the market.
Even as the machine trades, what the machine does is still created by a human, and as we humans haven't been able to program a full replacement of ourselves, any machine implementation must be a simplification of a human and if you want to make it fast it has to be hugely simplified - Lakeview Capital's Kleef
And with this simplification comes the weird flocking behaviour of HFTs, where once the algorithms notice that someone has started to unwind their position, they will all do so in turn, as happened with the flash crash.
This leads to a downward spiral where, very quickly, liquidity in the market can dry up at key times as all algorithms divest themselves of their positions and try and wait out the rough parts. A recent report found that in at least one case the top eight HFT's removed liquidity from the market 59 per cent of the time, so they actually prevent the market recovering as quickly as it would if there were institutional investors keeping an oar in during price storms.
"The market is not physics, it has no laws of physics. It's more human interaction, more game theory than physics," says Kleef.
Ultimately the problems of a market populated by an HFT are a reflection of problems that have dogged people for time immemorial – namely, getting along together in a sensible, reasonable way when every individual is encouraged to be as selfish as possible to get ahead.
We would note that game theory is about maximising the benefit of the individual operator in an aggressive kill-em-all market – HFT's are not built to help each other, but to drive each other into the ground. ®
Sponsored: Today’s most dangerous security threats