trading hackers
High frequency trading (HFT) and other ways to cheat markets are now being surpassed by advancements in machine learning which are now growing within financeGetty Images

Weaponised algorithms and artificial intelligence attacking the world's financial system – it sounds like something straight out of "The Fear Index" by Robert Harris, or maybe the plot of a James Bond flick. But this is the new reality.

High frequency trading technologies have infiltrated markets over the last decade. We have seen unprecedented episodes of volatility and flash crashes, leaving regulators as bewildered as everyone else. Technology which was once confined to investment banks or hedge fund managers has made its way into the retail space, and it can be relatively easily modified. In addition, recent advancements in machine learning and AI are entering a number of fields, including finance.

Kristian Kristiansen of QuantAlliance, which develops trading algorithms focused on Forex and commodities, told IBTimes UK: "Weaponised algos [algorithms] are software specifically designed to manipulate stock markets and start a market crash. The effect of this is not only a loss of assets, but the creation of fear that will manifest in investors. It will prevent them from creating further investment, or they will make significant downgrades in the amounts they invest. This in return will have a serious impact on any economy, even one as big as the US.

"The scary thing is that software like this is pretty easy to make, and can be constructed for a very low cost. It's only possible because the majority of trades are currently performed by algos. The software I'm talking about will simply 'trick' the algos to sell and this will create a chain reaction in other algos and spark a crash."

Kristiansen believes there are too many blue chip algorithms with vast sums under management, relying on analysis of market orders. The problem is that orders can be made without being executed. "I can place an order to sell stocks worth hundreds of millions of dollars, and never actually do it. But other algos can see I placed the order and many of them will react to this," said Kristiansen.

Flash crash

"If just one big algorithm reacts and actually starts selling as a result of my actions, this will start a chain reaction with others. And you have to keep in mind many algos are specifically designed to follow other algos. There are even algos designed to follow the ones who are following. It could get very bad very fast. Look at the flash crash of 2010."

The 2010 trillion dollar flash crash lasted approximately 36 minutes. Navinder Singh Sarao, a trader who operated from his parents' house in suburban West London, is being blamed for "spoofing" the markets and triggering the crash. Sarao amassed nearly £30m using his moderated trading software. But market commentators have said blaming a single trader for the crash is like blaming lightning for starting a fire.

How Do Trading Algorithms Work?

Here is an example of a simple algorithm investment thesis: "The top-performing stocks from last week will do worse this week, and vice-versa."

So when the markets open on a Monday, the system ranks high-volume stocks based on their previous five day returns, and goes long (bets on a price increase) on the bottom 20% of stocks with the worst returns over the past five days, and goes short (bets against) the top 20% of stocks with the best returns over the past five days.

High frequency trading (HFT) and other ways to cheat markets are now being surpassed by advancements in machine learning which are now growing within finance. The British artificial intelligence (AI) company DeepMind Technologies was acquired by Google in 2014, and investment firms like Bridgewater Associates and Highbridge Capital have been tapping innovations in big data using techniques previously confined to universities.

Machine learning

Machine learning and algorithmic trading will apply intelligence to markets, as opposed to HFT techniques which used raw speed to cheat them. "It doesn't help to be the fastest, if your opponent can predict your moves," notes Kristiansen.

He said when QuantAlliance tested its first basic AI algorithm it only took it five days before it "invented" the Martingale system all by itself with no human input. In a martingale betting strategy the gambler, who wins his stake if a coin comes up heads and loses it if the coin comes up tails, doubles his bet after every loss so that the first win would recover all previous losses plus win a profit equal to the original stake. The system assumes the gambler has infinite wealth; in reality the exponential growth of bets would eventually bankrupt "unlucky" gamblers.

"It simply learned this was a mathematical solution to win. I really don't think people understand the fundamentals of AI, or that it's already a reality," said Kristiansen.

Kristiansen thinks intelligent algorithms will learn how HFT algos are cheating and outperform them. "AI algos will simply reverse engineer the advanced HFT algos from the large banks and hedge funds, and force the banks to change their focus to AI algos if they don't want to be outperformed."

Fight algos with algos

Kristiansen maintains that intelligent algorithms are the best defence against nefarious technology of the sort associated with flash crash trading. He believes that regulators have taken the wrong approach, trying to find ways to regulate algorithms since the 2010 flash crash, some of which will come into force in 2017 as part of MiFID II.

"To be honest I think the regulations coming in 2017 are already too late. I believe algorithms are moving more in the direction of machine learning and artificial intelligence."

Regarding the regulation of HFT algorithms, the violations will likely be small and almost impossible to uncover, he said. Trying to introduce vanilla algorithms – out of the box and turnkey solutions – will mean poor performance and leave markets even more open to manipulation.

Kristriansen sees a future where algorithms are running on markets purely to investigate what other algorithms are doing, to detect when one of them is up to no good.

He said: "The point is not whether algorithms are good or bad, but whether we should focus on the fact that algorithmic trading could be deliberately weaponised just as computers and phones can be weaponised for cyberattacks. It's a yin and yang situation where algorithms are both the threat and the solution. One thing is certain, if you try to fight the robots as a human, you will lose. Algorithms are here to stay, whether we like it or not. Just like computers."

It seems likely criminals or even terrorists will weaponise algorithms for attacks at some point in the future. When it happens, the safest thing for investors may be have their investments in other algorithms.

* The headline of this story originally mentioned terrorists and Isis. Mr Kristiansen has pointed out that he did not make comments to this effect and asked if these could be removed. We would like to apologise to him for this mistake.