The proliferation of financial Big Data and the rise of High-frequency trading (HFT) are creating new challenges for investors, traders, and stock analysts. Making the right investment decision and executing a trade in a timely manner are becoming much more complicated. Information has proliferated to the point where an individual is unable to keep track of the volume of daily trades, the businesses being traded and the news and social media data to be analyzed. The task of finding the right investment gets even harder when investors and brokers have to act under natural time constraints and the tight deadlines of the market where decisions should be made on the spot. With recent breakthroughs in Artificial Intelligence (AI), Machine Learning (ML), and Natural Language Processing (NLP), financial companies are beginning to pass the task of identifying and executing trades on to automated systems. Algorithmic Trading (AT), smart stock advisors, and ‘self-learning’ Reinforcement Learning (RL) agents now powerful tools in the financial decision-making process. In this white paper, we’ll discuss how financial companies can benefit from the ongoing AI revolution in their investment and technical analysis, portfolio management and diversification, and other important areas of investment decision-making. Hopefully, by the end of the paper, you’ll have a better understanding of how AI can boost a financial investment strategy.
Use Cases for AI in Financial Trading
Artificial Intelligence (AI) and Machine Learning (ML) have already been used in financial trading in areas such as asset price prediction, simulation of the stock market, investment strategy development, portfolio management and diversification, technical analysis of financial charts data, and more. We will discuss the basic use cases for AI in financial trading and show how the integration of this technology can lead to a qualitatively new model of financial trading close to Artificial General Intelligence (AGI).
AI-based Asset Price Prediction
Predicting the movement of asset prices has been one of the most challenging tasks of investment decision-making and analysis. Over the past several decades, the financial sector has developed complex statistical and probabilistic methods for technical analysis which search for patterns in the financial time series to predict the future movement of prices. However, until very recently, most approaches to technical analysis such as Japanese candlesticks, heavily relied on the trader’s intuition, financial rules of thumb, and other pseudo-scientific practical approaches.
The arrival of supervised ML and Reinforcement Learning (RL) propelled by vast datasets of financial data and facilitated by the cheap and fast computing resources makes a huge difference in the accuracy of asset prices prediction.
Supervised learning is a sub-discipline of Machine Learning that uses accurately labeled and regularized data (i.e structured data) to learn the optimal model/hypothesis that explains patterns and relationships in this data. If applied to financial trading, supervised learning algorithms search for patterns in the financial time series to derive a generic model of the price dynamics over time.
The end result is achieved through the iterative optimization/fitting of the initial hypothesis (normally some parametric function) to the training data until it fully explains the underlying pattern/model that generates such data. The model derived in this iterative optimization process can be then applied to price prediction using real-world financial data. The main assumption of this supervised learning model is that if it can explain the past movements of prices, it can also predict the future prices.
As it turns out, supervised models for financial trading are quite strong in predicting short-term price dynamics. If the training data fed to the supervised learning algorithm belongs to one homogeneous market trend (e.g one-week trading period) and the trained model is used for the real-world data that falls within the same trend, we can expect the supervised model to predict prices quite accurately. However, supervised models are less efficient in predicting long-term price dynamics because the hypothesis and data fed to them often reflect transient trends rather than universal laws. Also, they are often based on the manually engineered features that are biased by some implicit understanding of how financial markets work. Finally, it’s rare that supervised models are able to formulate some explicit trading policy. Being based on rigid trading rules and decision thresholds, they fail to react to changing market trends and have a narrow scope of available investment strategies. That’s where Reinforcement Learning (RL) models can shine.
Reinforcement Learning (RL) to Develop a Sophisticated Trading Policy
The development of the AI-based agents with a flexible and automatically adjustable investment policy has recently become possible with the advances in Reinforcement Learning – a sub-field of ML widely used in robotics, autonomous driving, and board games engines (e.g Go and chess)
In a conventional RL model, we have an agent (e.g algorithm) that acts in the environment that continually emits certain rewards and punishments for the agent to refine his behavior. Based on this feedback, the agent evaluates the success of a particular action (e.g selling or buying a stock) and gradually adjusts its policy to become more efficient. At the end of the day, by experimenting with the environment and evaluating its feedback, the RL agent is able to come up with the optimal policy framework or strategy.
As it turns out, using this self-learning potential of RL agents in financial trading, we can develop more nuanced and sophisticated learned policies that enable more accurate and timely strategies and actions and price prediction. An RL agent has no hard-coded rules to follow: instead, it can formulate its own rules and policies depending on the market response and accumulated experience. For example, an RL agent can dynamically change a high-frequency trading strategy for the medium or low-frequency trading and vice versa, decide on the volume of trade, and adjust trading decision thresholds depending on the emerging market trends, historical movement of prices, and responses of other agents. In this way, an RL agent learns how to behave by experimenting with its environment (e.g stock market) continuously refining its strategies and fixing past errors.
The RL approach discussed above can be further enhanced by combining RL with powerful Deep Learning (DL) architectures that enable learning of complex non-linear hypotheses from unstructured data. The conjunction of RL and DL can produce investment policies and rules more powerful than any human trader could possibly formulate relying solely on his knowledge, intuition, and experience.
RL for Modeling Other Trading Agents
As we’ve said, Reinforcement Learning (RL) has been widely used in solving board games like chess or Go. Over the past few years, RL models such as AlphaGo and AlphaZero invented by the Deep Mind company acquired by Google Inc. outperformed all existing game engines in the games of chess and Go displaying a fantastic level of strategic thinking that goes beyond brute force and dynamic programming approaches of the past. A great success achieved by RL models in board and computer games owes to their powerful ability to act in simulated environments and model behavior of other agents (e.g other players, contenders).
This feature is directly relevant for financial trading where the ability to predict the behavior of other agents has been always regarded as a powerful advantage. However, the enormous size and the ‘black box’ nature of the stock market pose challenges which are hard to address using traditional game-theoretic approaches. However, as it turns out, the ability to learn through trial-and-error and generate one’s own experience make RL agents powerful in understanding possible motivations of other stock traders. In particular, RL models can identify various market signals that emerge from their trading decisions and understand whether they are attributable to the market response of other agents. Such usage of RL is a promising field of research that is still in its infancy though. However, the progress is already on the horizon.
Deep Learning for Financial Technical Analysis
Deep Learning (DL) is a new sub-field of ML that has fueled recent advances in video and image recognition, machine translation, and Natural Language Processing (NLP). The main difference between DL and supervised learning is in the use of feature learning or representation learning instead of manually engineered features. In feature learning, the model automatically extracts meaningful features from data and creates multiple layers of abstraction to represent this data. Such an approach is motivated by the fact that unstructured data such as images, audio, video or speech is hard to define in terms of the manually extracted features. The same is true of the financial charts data for technical analysis which can contain hidden features not known by the researcher before the formulation of the ML model. The solution is to let the intelligent machine find those features automatically and derive more efficient and non-linear models which are hard to formulate using underlying theories or assumptions.
Key benefits of DL for financial trading include:
- DL networks use cascades of multiple layers that enable the discovery of complex non-linear hypotheses through structural representation and abstraction of training data. In terms of trading, such an approach allows for the recognizing of long-term trends in data, identifying hidden patterns, emerging trends and market signals, and finding the correlation between different investment assets.
- DL models can learn multiple knowledge representations that correspond to different levels of abstraction. This feature is especially useful in representing complex unstructured knowledge like language, reasoning, and financial time series data.
- DL models display great performance on large data sets such as financial time series data. Marrying supervised price prediction with DL architectures like LSTMs (Long Short-Term Memory Units) or RNNs (Recurrent Neural Networks) can enable us to better predict long-term movements of prices.
- Financial markets are hard to predict due to occasional market shocks and black swan events. Being powerful in spotting non-linear structures and patterns in financial data, DL can better predict volatility, market crashes and other non-linear events to improve financial risk management.
- Since DL works in the latent space, it allows for the combining of market data (quantitative data) with qualitative data like market reports, news, blogs to construct better predictive models that incorporate both technical and non-technical market analysis.
CNNs: Plugging-in Image Recognition in to Financial Charts
Originally designed to recognize and classify images, Convolutional Neural Networks (CNNs) turn out to be effective in recognizing patterns in financial time series. In a nutshell, CNNs imitate human visual cortex in which cortical neurons respond to stimuli only from restricted regions of the visual field known as the receptive field. These receptive fields of different neurons partially overlap covering the entire visual field. Modeling this structure, the CNNs layers and neurons are designed as receptive fields that gradually move from the low-level regions and features like points and angles to abstract geometrical objects that represent higher levels of abstraction. In this way, CNNs breaks an image into multiple overlapping perceptive fields and then runs multiple filters through them to extract complex features and patterns.
Since financial time series are images too, we can apply CNNs to find patterns and features in them, which could tell us more about future price movements and trends. For example, as Ashwin Siripurapu did, we can develop a CNN with filters sensitive to short-term market trends and then join them with filters that focus on the greater part of the financial time series image which represents long-term trends. In this way, we can divide financial charts into multiple layers and perceptive fields that correspond to different patterns in financial data reflecting both short-term and long-term trends. Treating financial charts as raw images with patterns to be recognized is, indeed, a revolution in technical analysis that previously relied on statistics and probabilistic methods.
AI for Stock Ranking
These days, there are over 630,000 companies traded publicly all over the world. The abundance of stocks, bonds, and equities and the presence of thousands of hedge funds competing for revenue, makes deciding upon the right investment target more complicated today than ever. Human traders are struggling to make sense of the non-stop flow of news and financial data to figure out the best compositions for their portfolios. However, with state-of-the-art AI stock ranking and performance prediction, they can breathe a sigh of relief. Stock ranking AI tools are normally based on parametric models (like linear or logistic regression) powered by multi-layer neural networks like LSTMs or RNNs. As a training set, AI stock rankers can use diverse types of data such as financial time series data, technical indicators (e.g candlestick patterns), SEC filings, corporate reports, news, and social media posts. In particular, Deep Learning allows for the integrating of these diverse types of structured and unstructured data into one model. Putting these types of data together and powering them with neural networks yields powerful prediction models that can identify the best candidates for investment. The main benefit of the ML stock ranking models is their ability to take numerous economic and extra-economic factors into account and learn non-linear features of stock trends that cannot be easily recognized even by the most experienced stock traders.
Portfolio Diversification with Machine Learning
Portfolio management is one of the most important fields of financial trading that studies efficient combinations of stocks to generate the highest returns while keeping risks to a minimum. Until very recently, the central paradigm of portfolio management was Modern Portfolio Theory (MPT) according to which there is an optimum strategy for a given portfolio that maximizes returns at a given level of risk. However, recent advances in Deep Learning and Reinforcement Learning are revolutionizing conventional approaches to portfolio management and risk management.
In particular, advances have been made in the ML-based portfolio diversification. AI stock advisors can compose a portfolio by analyzing hundreds of stock features like alpha, beta, Sharpe ratio, Maximum Drawdown (MDD) Risk Measure. Based on this analysis, the algorithm identifies stocks with different risk premiums and return potential and builds an efficient diversification strategy for individual stocks, industries, and geographies. By adding risk measures into the equation, the algorithm ensures that stable returns are secured while losses are kept to a minimum.
One of the most promising AL techniques used for the algorithmic learning of diversification strategies can be found in Reinforcement Learning. For example, Jiang, Xu, and Liang (2017) use RL in their model built around the Ensemble of Identical Independent Evaluators (EIIE) – an ML-based system that studies the history of assets to evaluate their future growth and risk premium. For each studied asset, the model creates a portfolio weight which determines how many stocks of this type should be kept in the portfolio for the upcoming trading period. If the target weight of an asset increases, the RL agent would buy an additional amount of it and sell if the weight decreased. At the same time, the RL agent would take various risk metrics such as Sharpe ratio into account to ensure that the proper balance between high-risk and low-risk stocks is achieved. It will also ensure that assets are diversified by asset type and economy sector. The discussed RL model is highly adjustable and dynamic – the RL agent constantly refines its policies using the model’s feedback to develop more sophisticated diversification strategies. It also keeps the memory of previous states in Portfolio Vector Memory (PVM) layer that allows the agent to take the effect of transaction costs and various extra-market factors into account.
Evaluating Market Sentiment with Natural Language Processing (NLP)
Price prediction is usually based on three types of analysis: technical analysis, fundamental analysis and the study of the market sentiment. While the methodology for technical and fundamental analysis has been substantially improved over the past four decades, the analysis of market sentiments has been traditionally regarded as the field where intuition and educated guesses played a greater role than science. As a result, until recently, we were limited in our ability to explain the dynamic of market sentiment. However, with recent advances in Natural Language Processing, we can now make a significant progress in the understanding of various subjective variables like risk-averse or risk-seeking behavior, investor confidence, and psychological factors that drive the arrival of bearish or bullish markets. In particular, we can use the sentiment analysis with RNNs and built-in memory mechanisms to evaluate the sentiment (e.g positive, negative, neutral) of various types of data like financial news channels, data trading sets, customer feedbacks, investor blogs etc. This can be achieved by character-to-character and word-to-word mappings that turn each language token into word vectors that represent the semantic proximity of words. The NLP algorithm can then use these vectors to study the sequence of text (e.g blog post) identifying ‘positive’ and ‘negative’ signals/words and comparing them with the previous signals stored in memory. During this process, the algorithm will gradually adjust ‘positive’/’negative’ scores calculating the probability of the entire text being ‘positive’ and ‘negative’. If we feed thousands or even millions of finance-related texts in such an algorithm, we can derive a pretty accurate picture of the market sentiment in a given period. Thus, NLP can become a powerful tool for identifying the changing market trends and the impact of news on the trajectory of the market.
As we’ve seen, recent advances in Artificial Intelligence are drastically reshaping the financial trading industry. In particular, with Deep Learning and Reinforcement Learning, we can already create intelligent agents capable of developing sophisticated trading strategies through experimentation and trading experience. These strategies are much more flexible and nuanced than conventional hard-coded rules and even dynamic programing approaches. Similarly, with the advances in Convolutional Neural Networks, investors have an opportunity to identify hidden signals and trends in financial graphical data and convert the acquired knowledge into more efficient investment decisions. Advances in AI-based price prediction and technical analysis are matched by the important breakthroughs in the sentiment analysis, which allows us to identify important subjective variables of market behavior in unstructured data like blog posts, consumer feedbacks, and market reports. Combining conventional technical analysis with the analysis of market sentiment has a promise of opening a new epoch of Artificial General Intelligence trading in which intelligent AI agents are endowed both with a power of rational reasoning and intuition and the unmatched faculty of prediction and pattern recognition.