ProjectBlog: AI in Stock Market Prediction

Blog: AI in Stock Market Prediction

Go to the profile of Sonish S

AI, or more precisely machine learning (ML) is taking over the world.

ML models can be done with minimal coding knowledge, and are able to churn out some stunningly accurate results, and hence are used in a whole range of different industries.

People are always looking for new models to make as all you need to create one is a large set of, preferably numerical, data and a computer. Where can you find a huge collection of numbers? The stock market.

It is not only the availability of data that makes this particular usage of ML appealing, there is a vast amount of money to be made in the industry, so anyone who could effortlessly anticipate movements would surely make billions. Or would they?

The Predictability Paradox

Let’s start with a story.

In a post-Brexit UK (sorry), government is unstable and rebellions are rife. The current leader can only hang onto power if they are able to predict, and successfully quash these uprisings.

To do so they employ a computer scientist to build an ML model. Based on ten different factors, the algorithm can predict, with 100% accuracy when the next rebellion will start.

The Prime Minister tries it out and it returns a date exactly 3 months from now.

Parliament could fight it, but the odds are slim, so instead they put in measures for damage limitation. Taxes are lowered, more money is pumped in the welfare system, and arrests of potential leaders are made.

When the day comes, the army are ready and waiting in Westminster. But nothing happens. No opposition comes.

Fuming, the Prime Minister goes to the computer scientist and explains how his algorithm is totally wrong

‘There was no revolt because I predicted there would be’ the man replies.

Predicting the predictable causes the predictable to become unpredictable

There is a name for this sort of occurrence. A Level Two Chaos Event (L2CE).

Crucially, an L2CE reacts to predictions made about it.

Take a scientific experiment. A biologist is estimating how tall a plant will grow. This is an example is Level One Chaos, the plant does not hear this prediction and deliberately try to subvert the scientist by not growing at all. Level One Chaos events do not react to predictions made about them.

The scientist may guess wrong, but there is no chance that he guessed correctly, and then because of this, the estimate became wrong.

Rebellions are Level Two. When one is predicted, the world, or in this case government, reacts to this estimation, and hence makes it wrong, or at least tries to.

The stock market is another example of L2CE.

Take AAPL stock, as I am writing this it costs $201.50. Let’s say I have a bot that predicts with, for arguments sake, 100% accuracy, and it states that by close today the stock will be worth $205.50. I would, of course, buy as much as I could now and sell it later on, making myself a tidy profit.

Microscopically, this works. Yesterday 67 million shares were traded, so nobody would notice if I bought and sold a few. The impact would be tiny, but so would the profit.

To maximise my earnings I would likely sell the code to a few huge investment firms who trade by the thousands.

That night traders at the firms, through the algorithm, see that AAPL stock will plummet tomorrow, each of their shares will drop by $10, so to avoid getting fired they sell them off.

The market is now flooded with shares, supply and demand would thus dictate a drop in the stock price. Within an hour of selling the shares, the price has already dropped by $10, a day earlier than expected.

What happens from here on is guesswork. The predictable has become unpredictable.

Wouldn’t they just look at the computer again?

Firstly, having just wrongly predicted a price, possibly costing the firms millions, traders are unlikely to trust it. But, even on the assumption that they have retained faith, it may well be misplaced.

Forget for a second that my algorithm is 100% accurate, because no bot will be, if there is a totally correct bot the market will break down. Let’s assume my program is right, or very close, 90% of the time. Anybody who has created such an AI will know that the 10% of inaccuracies come from sudden changes. In a basic ML model the same sum is applied to every set of input variables, and say the variables are price highs, lows, and closes, none of them give away a sudden change until it has happened, they can only estimate a small amount of movement based on previous fluctuations.

A more complex model might react better, it could sense coming changes of interest rates based of analysis of the news, or it might know that prices are particularly volatile when a new product is about to be announced. However, the share plummet as described above is not because of the company or the government. It is because of the bot itself.

This gives us a feedback loop. The program would have to predict share prices based upon variables including the share price it has just predicted.

In other words, the forecast given by a stock prediction bot can never be right, if the amount traded because of this prediction is great enough to make it wrong.


I am sure you are thinking of at least two ways around this:

  1. Only sell the algorithm to one company/trader
  2. Trade in sufficiently small quantities that it doesn’t affect the entire market

Sadly, monogamy in this case will not work. Not only is it unlikely that you will be the only one to develop such an algorithm, but even if only one firm had the technology, markets will still react to a mass movement of shares, whether they know why they are doing so or not, think Adam Smith’s invisible hand.

This poses the question, why don’t you just trade in untraceably small quantities. Money is the answer. As soon as you are trading with enough money to make it worthwhile, others will imitate you, because there is enough money to make it worthwhile in it for them.

You could, I suppose, trade small amounts of several companies and commodities, so as to make the profit but not the impact. However, the monetary conundrum remains. Such a bot would cost a lot and the operator would want surplus, and this still of course relies on only one firm having access to the technology.

This is not to say that an independent trader couldn’t make a pretty penny, but this article is about the bots taking over the world.


People may not have the prediction powers of a sophisticated AI but they can nonetheless accumulate huge knowledge of the market and make estimations themselves, in fact that is one of the underlying foundations of the whole stock market. Why would a good prediction made by a bot have more of an impact on the market than one made by a trader?

There are two main reasons for this. First of all, bots think alike. If one algorithm is developed first and sold to each major trading company, while improvements and changes may be made in the future, they will all make similar predictions as they are based on the same technology. A trader however will have different areas of expertise, different hunches and an entirely different thought process to one at another firm, thus they will trade different commodities while AI will likely trade the same.

Secondly, in each firm there can be thousands of human traders, each making separate decisions. If bots were employed, there would likely only be one, and if there were multiple, like above they would have very similar processes. Thus in a company that trades a million shares a day, a far greater percentage would be going into one commodity if a bot were used.

Source: Artificial Intelligence on Medium

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top

Display your work in a bold & confident manner. Sometimes it’s easy for your creativity to stand out from the crowd.