A Deep Learning explanation of the crazy stock market rally of 2020

Original article was published on Deep Learning on Medium

A Deep Learning explanation of the crazy stock market rally of 2020

One of the most disturbing news headlines of the past 90 days was the daily rising death toll of the Covid-19 Virus. Something that was even more disturbing was to see the wide and wanton destruction of businesses and wealth of people. Factories shutting down and cafes closing in face of the “ultimate threat to humanity”. But, for a lot of commentators and journalists and people one of the most disturbing images was of Stock Markets recovering in the face of an absolute calamity.

Stock Markets Total Lack of Empathy for Main Street

So, why did the markets make a new high in an environment of absolute despair? Why did people hire 2.5 million more back to jobs in the US and more in the world in the face of huge despair and losses? I decided to stop reading the headline and doing what I am best at. Use technology to explain the absolutely unexplained.

My hypothesis is as follows:

The market is essentially the largest and most trained and most accurate deep learning model ever built. It is trained to absorb the news flow and give the output of asset prices.

This means that the markets can get it wrong in the long run, but in the short run they are invariably right. Possibly, they are the best at processing the immediate impact of the information available due to the high number of participants and the efficiency of information that is being distributed.

The Construction of the Deep Learning Model for Stock Prices

A typical neural network model has 3 components:

  1. Input Nodes
  2. Middle Layers (Which do the heavy lifting)
  3. Output Nodes

Input Nodes are sources from where the learning inputs are given — Let us assume they are the sources of news like TV, Websites like Bloomberg and Reuters, News Sources like CNN and Straits times, Government sources of data that is released every day which could include COVID Data and or Trump Tweets and finally Company Specific Data Releases.

Data Inputs and Outputs for Financial Depp Learning

Output Nodes output the next ticker print of the stock prices in the form of three outputs Buy, Sell, Hold. The decision of the market participants on these individual decisions drives the behaviour of the buyers and sellers in the market.

Hidden Layers

This is the most interesting part. Each person that is a participant in the stock market, be it a sell side analyst, or a buy side trader or an investment banker or management of companies, makes decisions based on his processing of these inputs into the three outputs. The weights assigned to each input is dependent on the model that applies to each participant. Each of these participants (hidden layer) either feeds input into another participant (node) or makes a final decision (Feeds into Output Layer)

Feed Forward Mechanisms

This is the process of making decisions based on inputs to the nodes. In deep learning typically the decisions output of a node would be fed as input to a second node and so on and so forth until the system reaches a decision. Similarly, in the financial markets the participants like Analysts feed information to their clients (fund managers) and their channels (TV, Bloomberg, Social Media etc) for it to be consumed by the fund managers to make decisions.

Feed Backward Mechanisms

In Deep Learning this is the process used to train the model. There are several methods of propagating the errors in judgement by the model lille Gradient Descent Model, etc. Without getting into technicalities of all of them, they rely on adjusting weights to Inputs with the sole intention of reducing the error in judgement. Does this process sound familiar? The Analysts and news sources that are most credible seem to get most attention from the fund managers and traders pulling the trigger on the buy / sell decisions.

Convolutions and pre-processing of Inputs

This is the part of Deep Learning where the inputs are literally simplified for easier consumption during the training process. Cutting the big jargon out of the discussion all that it means is that someone or some layer ( node) is taking data like Tweets, company announcements, Jobs data etc and converting them into bite sized information that decision makers can use to make decisions. Simply put — the mental GPUs of Fund Managers are typically small and hence they need the pre-processing of data to be able to help them assign correct weights to inputs to make the decisions.

So, why does Wall Street make the peaks while the Main Street is in doldrums?

The Wall street is a well oiled Deep Learning Machine that processes existing inputs in the most efficient manner so as to arrive at optimal decisions given current levels of information availability and asymmetry. As the motive is purely to maximize individual gains and not to be the best philosophy or the fairest markets, each of the hidden layers ( market participants) operates at weights to inputs that are optimal for them given the current mechanisms of feed forward of decisions ( analyst reports, TV Channels) and the current mechanisms of feed backward for adjustment to weights ( Decisions on who is a good analyst and whose tweets count and why number of covid cases might be important today but not tomorrow).

Single hidden layer model for a single analyst

I shall build it as a single layer model for the sake of designing the concepts and then slowly dilute the assumptions to add multiple layers. Ultimately, we want to arrive at multiple hidden layers.

So, now we arrive at a basic model for the stock market with a Single Analyst that is given graphically below

Standalone Model for Stock Analyst *Note that weights are not normalized

Single Hidden Layer Model for a Single Fund Manager Plus a Sell Side Analyst

Now when we add a fund manager to the wall street, the fund manager, makes his decisions on whether to increase or decrease his positions in a particular stock using inputs from the analysts and the important data points to the market and then feeding them into his models with adjustments for his current positions and limitations of his funds mandate. Below is a simple schematic of a deep learning model with a convolution layer of a sell side analyst.

Standalone model for fund manager and stock analyst *Note that weights are not normalized

Extending this to the deep learning model for wall street

I will leave it as a little extension of thinking and to the imagination of the reader to extend this thinking to the modelling of TV news stations, Financial news journalists, Individual day traders, Company managements, Investment Bankers, Derivative Traders, Governments, Members of Parliaments, Central Bankers, Repo Traders, and any or all participants to the markets. Here I jump forward to why Wall Street makes optimal short term decisions which might be in total variance with all that we call humane or good in the long term.

The financial markets is a multi-layer deep learning machine that is optimized to make investment decisions based on maximizing short term gains. So, when the Central banks increase money supply by printing money or when the governments increase the fiscal deficits, while it might be bad in the long run, and might not create jobs or improve the balance sheets of individuals or small businesses, it does inflate the share prices to those that reflect these moneys coming to the market.

Let’s take a timeline to explain this:

It’s Feb End and the seriousness of the situation from Covid is acknowledged by the world. By March the decision makers are worried as large companies could fail due to stretched balance sheets not being able to cope with impacts of lock-downs and fall in sentiment.

Markets fall in apparent empathy with pains and Job Losses in Main Street. The weights to defensive decisions is much higher than weights to aggressive decisions. The stock market is now optimizing the model for preserving capital rather than maximizing profits.

We fast forward to May end

The world has been drenched in money. The dangers of companies running out of money has been taken off the table. While the main street is still suffering losses in confidence and jobs, the stock market now attaches more weights to getting returns from stock markets over the actual status of the businesses underlying.

The markets rise to new peaks while the main street wallows, as the financial markets deep learning model has changed the weights it attaches to defensive inputs and reduced them and concurrently changed the optimization functions to maximizing profits over preservation of capital.

So, What next from here?

In the world of zero / negative interest rates and efficient markets with changing transmission mechanisms, many of the traditional models for pricing risk will become redundant. As an example, the VAR models for pricing risk, Monte-Carlo simulations, Black Scholes model for Options pricing, Market making models assuming bid offers that follow some rules will all change. Deep learning could provide a great opportunity to create long term advantages over traditional models in terms of risk evaluation that could significantly impact the out performance of returns.

This is the new form of the fund manager’s Alpha that could outstrip the returns of all forms of investment practices that depended on closed form solutions for returns.