There are about 20 major stock exchanges around the world, with each country having many more regulated stock exchanges. A large stock exchange like NASDAQ, does about 10 million trades, with over 1-2 billion shares traded every day.
Movies like the Wolf of Wall Street have popularised the image of a stockbroker and their glamorous high flying life. And if your image of what a stock trading unit looks like, is something like the image below, then we don’t blame you –
This image is very disconnected from reality. Almost 90% of all short term trade, and about 50-70% of all trade, is done by stock trading algorithms. These are machine learning algorithms that buy and sell in the stock market, at a phenomenally fast pace.
There are many kinds of stock trading algorithms – from those which will execute simple buy and trade functions (at phenomenally high speeds, mind you), all the way to analysing the news to forecast which stocks to buy and sell. Here’s a really nice explanation of all the different kinds of stock trading algorithms – http://hck.re/erIYgs.
In fact, there are some algorithms that exploit the behavior of an opponent’s algorithms for a profit. Mike Beller, the CTO of Tradeworx explained a classic example of what an exploitative algorithm can do. In 2012, an algorithm started to rapidly buy the stocks of food company, Kraft foods. This artificially increased the value of each of these stocks. It is said that the algorithm spent about 200,000 USD in buying the stocks and then sold it for a whopping 900,000 USD. That’s over half a million dollars in profit.
Of course, this was corrected and all trades pertaining to this was cancelled and dubbed as a technical error. However these algorithms are phenomenally powerful, and to a large extent, humans are at its mercy. How, you ask? Read on –
The real need for speed..
It is said that a simple buy and sell algorithm can execute up to 1000 trades a second. Compare this to 11-12 seconds that a human takes to execute a single trade. So, how did we get here?
It is imperative, that the first one with information, is usually going to win. It’s the same logic behind kings using pigeons to send information, so as to beat the enemy king’s man on horseback. This same is more pertinent in stock trading.
The simple mantra of getting rich in the stock market is buying low and selling high. So the first to get information about a rising stock has the advantage of making more money than someone who gets the information at a later time. This simple need, set off a mini arm’s race in the stock trading market.
.. Is when the speed of light isn’t fast enough
As electric pulses, the speed of the data is restricted by the speed of the electron, which is about 2,200 km/second. With fiber optic cables, the speed of data transmission is restricted only by the speed of light, which is about 300,000 km/second. These are mind boggling numbers, but in the world of algorithmic stock trading, even microseconds in delay is a missed opportunity.
Let me explain – someone sitting in New Jersey will receive information faster from New York, than someone sitting in California. The distance needed to cover is lesser, so you’ll get your information much faster. Of course, this is the speed of light that we’re talking about, so the difference is really in microseconds.
But that’s more than enough for an algorithm to execute a trade. It is estimated that an algorithm can execute a trade in about 10 microseconds. This became an issue in the USA, as traders began buying real estate closer to the NYSE and NASDAQ so as to counter this problem.
The solution that NYSE came up with, is to provide server rooms for companies, where a company’s server will be placed in a room right next to the NYSE server rooms, and the cable length from the NYSE servers to a company’s server will be exactly the same, for everyone who buy’s space in NYSE.
A fair solution – only it didn’t stop the arms race.
We’re more connected than ever
Back in the day, the US had 2 stock markets, namely NYSE and NASDAQ. As of 2 years ago, the US has 13 regulated exchanges and over 50 dark pools. And not all of them provide the on premises solution that NYSE provided. But that’s not even the problem.
There are different kinds of stock markets. There are markets that sell company equity and there are those which sell commodities, like gold, copper, wool, oil etc. And these markets are connected.
Take the case of oil – if the value of oil goes up in the commodity market, a petroleum company’s stock also increases. And these markets are not even in the same place. So, we’re back to the same need for speed.
In the US, there is a commodity market in Texas and the NYSE and NASDAQ is in New York. Massive amounts of money has been spent in creating a straight communication line between the two markets – blowing up mountains on the way to lay wires is just one of the many outrageous things that were done for this. All of this effort has achieved a maximum efficiency of 13 microseconds for an up and down communication. This is still slow, as a computer still has to wait an enormously long 3 microseconds before it can execute a buy/sell function.
When will this end?
Not anytime soon. It’s been found that the speed of light is faster in air, as opposed to a fiber optic cable, which has further reduced the time to 8 microseconds for communication between Texas and New York. Who knows what we’ll find tomorrow?
And given that things are happening at such breakneck speeds, it’s very tough to analyse and find the reason behind many stock market crashes. Listen to the last 10 minutes of this Podcast for one fascinating event. A circuit breaker tripped and the NYSE lost power for 5 seconds. The market plummeted almost a 1000 points. Funnily enough, it came straight back up as soon as the power came back. Worryingly, no one really knows what caused it, even to this day.
As with any other profession, every time a computer replaces a human, 2 things happen –
- The execution of the task become more efficient – The arms race is only going to result in better efficiency and performance in stock trading.
- The execution of the task also becomes cheaper – 10 years ago, it costed 100 USD to trade a 1000 shares. Today, 10 USD for the same.
But in this case, one thing remains. Machine learning has given bots a brain of their own and because of the speed at which things happen, incidents like the unexplained stock market crashes leaves us with the haunting question – how long till we lose control?
There are 3 tracks at IndiaHacks that will test your expertise at a skill that has resulted in the bots of wall street –
2) AI challenge
Give them a shot at IndiaHacks!
Here's what you can do next
Check out FaceCode:
an intelligent coding interview tool