AI: Making Sense Of The Equity Market Chaos

Oct 29, 2019 · 9 min read

We live in massively complex systems. AI helps us see through much of the noise. In the world of algorithmic trading though, chaos is a lot more intense. Can AI make sense of the chaos and reach the algorithmic trading singularity?

The transition from the traditional auctions to computerized transactions began as early as 1970s. Stock exchanges started transforming to electronic markets as computers that executed trades faster and faster appeared. Computers enabled trading algorithms to access and act on information more quickly than human traders.

A boost to the adoption of algorithmic trading in the financial markets came in 2001 when IBM researchers demonstrated that algorithmic strategies could consistently out-perform human traders in financial markets.

With $5+ Trillion daily trades, currency trading is by far the biggest asset class in the world. Adding stocks, bonds, commodities & the new asset class: cryptocurrency, the daily trading volume reaches close to $6 Trillion. Currently 75% of all trading is automated algorithm based. To profit in electronic market places, especially those hosting volatile financial instruments (such as cryptocurrencies), a user must be able to react quickly.

The big chunk of these HFT (high frequency trading) transactions are controlled by powerful computers operated by big banks, mutual funds, hedge funds, insurance companies, institutional investors, etc. They’ve invested a small fortune developing trading algorithms. Advanced algorithmic trading bots use several indicators in thousands of possible combinations to design their profit-making strategies making it too complex and beyond reach of individual traders / users. It certainly leaves retail investors at a disadvantage.

Although advancements in Artificial Intelligence and processing speeds are pushing the limits, algo-trading is still not an exact science that guarantees profits & eliminates losses altogether. It has reached a threshold beyond which its efficacy may not be pushed to any significant level. And, it certainly isn’t accessible to common man. Winning algorithmic trading strategies are rare and short lived.

Algorithmic Trading Vs AI Trading

Algorithmic trading is the use of computer algorithms to automatically make trading decisions, submit orders, and manage those orders after submission. It is about implementing trading rules into a program and using the program to trade. Conceptually, it comprises of three components which handle different aspects of the algorithmic trading system: the data handler, the strategy handler, and the trade execution handler.

Trading algorithms may be coded in a variety of different ways, including basing it on one’s own gut feeling. Taking human emotions completely out of the equation is what transforms algorithmic trading to A.I. Trading.

Artificial Intelligence (AI) can be defined as an approach to machine learning that learns the structure of the data, and then tries to predict what will happen.

In theory, a large number of machine-learning models have been built to predict stock prices. But in real world implementation none has achieved unequivocal success. Nevertheless, earlier this year IBM reported its AI beating the stock market on year over year basis.

While some consider AI as the potential Holy Grail of trading, others even claim to have actually discovered this Holy Grail, and yet others questioning it as a poisoned chalice. Well, it may not be a poisoned chalice, but there’s no evidence that anybody has cracked it either.

Why, in a world that uses machine learning to detect faces, navigate robots, drive cars, fly planes, beat the Chess and Go Champions, AI trading still remains an uncharted quest?

Equity Markets Are Extremely Chaotic

According to Edward Lorenz, the father of Chaos Theory, chaos is when the approximate present does not approximately determine the future. This is metaphorically referred as:

a butterfly flaps its wings in China and sets off a tornado in Texas.

Lorenzo’s plot of variables in weather prediction

The butterfly effect is the sensitive dependence on initial conditions in which a small change in one state of a deterministic nonlinear system can result in large differences in a later state.

In a chaotic system many uncontrolled forces or variables are at work. Their unpredictable interactions are so complex that extremely small variations in the strength of the forces and the way they interact can produce huge differences in outcomes. The higher the number of input variables impacting a system, the more erratic will be the output and more chaotic will be the system. The more chaotic a system, more difficult it is to predict.

Chaotic systems come in two forms: Level one and level two.

Level one chaos does not react to predictions about it. For example, the weather forecast. Although influenced by a large battery of variables, the predicted outcome does not get influenced by the weather forecast itself.

Level Two Chaos

When we say equity markets are extremely chaotic, we mean they are level two chaos. When prediction itself changes the outcome of the chaos, it is level two chaos. It is explained in the following illustration.

Assuming arguendo, that AI predicts with 100% accuracy the price of Microsoft stock price, it will instantly react to the prediction making the prediction impossible to be realized. For example, if the price of Microsoft share is $140, and AI predicts that it will be $200 in weeks, traders would rush to buy to profit from the predicted price rise. As a result, the price will shoot up to $200 over the next few hours or days rather than weeks.

The number of variables that may impact the movement of asset price in an exchange are near-infinite. This makes it very difficult to design machine learning (ML) models. Even if one picks up a few select technical indicators, weighting them accurately is an impossible task, because contrary to most ML modeling scenarios, the weights of variables in algorithmic trading models are wildly dynamic and not static, meaning the relative weights of each variable varies widely with each trading scenario. This further complicates the predictability. The essence of level two chaos is best expressed by Goodhart’s law, which states:

When a measure becomes a target, it ceases to be a good measure.

Can ML Tame The Chaos?

Machine learning (ML) works best with linear models in which variables are additive and quantitatively defined.

However, in algorithmic trading the variables are non-linear and chaotic. So ML models have to deal with variables which are neither additive nor quantitatively defined. In fact, the equity market variables are near-infinite making it virtually impossible to build any kind of consistent ML algorithm.

The complexity of predicting equities is best illustrated by the JP Morgan analysts’ analogy between share market and the complexity of the games of Chess and Go. A game of Chess is about 40 steps long, and a game of Go is about 200 steps long. In comparison, even with a medium frequency algorithmic trading which reconsiders its options every second, there will be 3,600 steps per hour. And, each of that step will have near-infinite number of input variables. With the current state-of-the-art, the complexity approaches impossibility, if not actually impossible .

A Scottish team recently described a new method to efficiently transform non-linear trajectories from dynamical systems into a finite set of variables. Another optimism comes from veteran chaos theorist Edward Ott’s group, who used reservoir computing to improve ML’s ability to predict chaos. Reservoir computing is a framework for computation in which an input signal is fed into a fixed (random) dynamical system called a reservoir, and the dynamics of the reservoir map the input to a higher dimension. The reservoir may also be viewed as an extension of neural networks.

These novel approaches may improve the predictability of class one chaos events such as a storm, heart attack, stroke, etc. But level 2 chaos of equity markets is still a far cry.

Reinforcement Learning

Reinforcement Learning (RL) is a type of ML, and therefore within the ambit of AI. It allows machines and software agents to automatically determine the ideal behavior within a specific context, in order to maximize its performance.

Last year J P Morgan released a report on the problems of ‘applying data driven learning’ to algorithmic trading. JPM avers that when designing a trading algorithm there are three cultural approaches to using data:

  • the data modeling culture;
  • the machine learning culture; and
  • the algorithmic decision making culture.

Most human-compiled algos are, “tens of thousands lines of hand-written, hard to maintain and modify code,” and as such, hugely complicated for mass adaption. JPM analysts prefer “reinforcement learning” (RL) algorithms, which use dynamic programming and penalize the algorithm for making a wrong decision whilst rewarding it for making a good one.

Pacman’s RL algorithm that rewards good decision and penalizes wrong decision. Credit:

“We are now running the second generation of our RL-based limit order placement engine,” -JPM quants.

Arbitrage Trading: Less Chaotic & Easier On ML

Arbitrage is basically buying a security in one market and simultaneously selling it in another market at a higher price, thereby profiting from the temporary difference in prices. These inter-exchange price differences are usually less chaotic and because they mostly involve finite number of quantifiable input variables, they do follow some pattern that ML can find much easier to exploit for profitability predictions.

So, obviously AI has much better chance with inter-exchange arbitrage trading as compared to intra-exchange trading.

Open Source RL Frameworks

Here are some open source RL frameworks recommended by JPM’s researchers:

OpenAI baselines, dopamine, deepmind/trfl and Ray RLlib.

The AI developers may find these resources helpful in bringing some order to the algorithmic trading chaos. Although there’s still plenty of optimism around AI trading, there seems to be a consensus that:

level two chaos in any given asset trade will always react to predictions about it, and therefore can never be predicted accurately.

There’s no evidence that algorithmic trading singularity is within reach or even a possibility in the foreseeable future.

We challenge the naysayers with our AI solution to this conceivably impossible problem.

The AlgoShare Approach

We are building AlgoShare approach to democratize the AI trading and make it profitable for everyone. This patent-pending technology is based on the following assumptions:

  1. At any given time, within a community, there will always exist a trading algorithm that delivers profitability: It may or may not be a product of any sophisticated ML or RL algorithm. It could be skill of a trader or just plain luck.
  2. Seamless, real time, equitable and incentivized sharing of profitable algorithms with peers: Whether intra-exchange trading or inter-exchange arbitrage trading, sharing profitable algos can help spread the trading profits amongst the participating peers.
  3. On account of the level two chaos coming into play, a profitable algorithm within a community will not remain profitable for long: Make hay while the sun shines, for it may not last for long. It is important to find out the algo’s profitability window. As there will be comparatively a lot fewer non-random input variables for AI’s ML/RL modeling to predict algo’s decay, AI can, with fair accuracy, predict the time of its loss of profitability.

AlgoShare’s Profitability Window: The Half-life

Once you begin with a profit making algo, level two chaos will soon make it redundant. However, the process of making the algo ineffective narrows down the input variables to just a few that ML can efficiently handle to predict the duration of algo’s profitability window. Since the loss of profitability is more akin to the decay of a pharmaceutical agent within human body than the shelf life of a perishable consumer product, we apply the dynamics of the half-life concept to predicting an algo’s profitability window. However such half-life will be a lot more dynamic and volatile than the relatively stable half-lives encountered in most of the in-vivo pharmaco-biological agents. This is because sudden real time events can anytime alter an algo’s profitability.

Algo Half-life gives a reasonable estimation of the time period during which an algorithm is expected to remain profitable. Just as the algorithm loses its profitability, AI kills it, and next profitable algorithm is picked from the leader-board of most profitable algorithms.


The Algoshare approach improves AI’s capabilities of predicting profitability in algo-trading and making it safe, secure, profitable even to the newbies with no trading experience. Most importantly, it can be deployed for spreading the wealth without taxing the economy or taking it from the rich and giving it to the poor.

AI powered algosharing is capitalism’s way of spreading the wealth and reducing the perpetually growing wealth gap between rich & poor.

About AlgoShare

AlgoShare is a massively disruptive patent-pending technology platform that democratizes the $1,460 Trillion Algorithmic Trading industry bringing algorithmic trading profitability to common man by sharing the winning algorithms and spreading the wealth among the most impoverished. More details at


Written by


AlgoShare Brings #Sharonomics to #HFT #Algo #Trading In #Currency #Stocks #Commodities #Bonds #Cryptocurrency. #Economics #Fintech #Blockchain #AI #UBI #Poverty

More From Medium

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade