12
Data Science Foundation Data Science Foundation, Atlantic Business Centre, Atlantic Street, Altrincham, WA14 5NQ Tel: 0161 926 3641 Email: [email protected] Web: www.datascience.foundation Registered in England and Wales 4th June 2015, Registered Number 9624670 AI in Financial Trading: White Paper Author, Kirill Goltsman A Data Science Foundation White Paper May 2018 --------------------------------------------------- www.datascience.foundation Copyright 2016 - 2017 Data Science Foundation

AI in Financial Trading: White Paper

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: AI in Financial Trading: White Paper

Data Science FoundationData Science Foundation, Atlantic Business Centre, Atlantic Street, Altrincham, WA14 5NQTel: 0161 926 3641 Email: [email protected] Web: www.datascience.foundationRegistered in England and Wales 4th June 2015, Registered Number 9624670

AI in Financial Trading: White Paper

Author, Kirill Goltsman

A Data Science Foundation White Paper

May 2018

---------------------------------------------------

www.datascience.foundation

Copyright 2016 - 2017 Data Science Foundation

Page 2: AI in Financial Trading: White Paper

Data Science FoundationData Science Foundation, Atlantic Business Centre, Atlantic Street, Altrincham, WA14 5NQTel: 0161 926 3641 Email: [email protected] Web: www.datascience.foundationRegistered in England and Wales 4th June 2015, Registered Number 9624670

The proliferation of financial Big Data and the rise of High-frequency trading (HFT) arecreating new challenges for investors, traders, and stock analysts. Making the right investmentdecision and executing a trade in a timely manner are becoming much more complicated.Information has proliferated to the point where an inpidual is unable to keep track of thevolume of daily trades, the businesses being traded and the news and social media data to beanalyzed. The task of finding the right investment gets even harder when investors and brokershave to act under natural time constraints and the tight deadlines of the market wheredecisions should be made on the spot. With recent breakthroughs in Artificial Intelligence (AI),Machine Learning (ML), and Natural Language Processing (NLP), financial companies arebeginning 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 theirinvestment and technical analysis, portfolio management and persification, and otherimportant areas of investment decision-making. Hopefully, by the end of the paper, you’ll havea 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 financialtrading in areas such as asset price prediction, simulation of the stock market, investmentstrategy development, portfolio management and persification, technical analysis of financialcharts data, and more. We will discuss the basic use cases for AI in financial trading and showhow the integration of this technology can lead to a qualitatively new model of financial tradingclose to Artificial General Intelligence (AGI).

AI-based Asset Price Prediction

Predicting the movement of asset prices has been one of the most challenging tasks ofinvestment decision-making and analysis. Over the past several decades, the financial sector

Page 3: AI in Financial Trading: White Paper

Data Science FoundationData Science Foundation, Atlantic Business Centre, Atlantic Street, Altrincham, WA14 5NQTel: 0161 926 3641 Email: [email protected] Web: www.datascience.foundationRegistered in England and Wales 4th June 2015, Registered Number 9624670

has developed complex statistical and probabilistic methods for technical analysis whichsearch 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 Japanesecandlesticks, heavily relied on the trader’s intuition, financial rules of thumb, and otherpseudo-scientific practical approaches.

The arrival of supervised ML and Reinforcement Learning (RL) propelled by vast datasets offinancial data and facilitated by the cheap and fast computing resources makes a hugedifference in the accuracy of asset prices prediction.

Supervised learning is a sub-discipline of Machine Learning that uses accurately labeled andregularized data (i.e structured data) to learn the optimal model/hypothesis that explainspatterns and relationships in this data. If applied to financial trading, supervised learningalgorithms search for patterns in the financial time series to derive a generic model of theprice dynamics over time.

Page 4: AI in Financial Trading: White Paper

Data Science FoundationData Science Foundation, Atlantic Business Centre, Atlantic Street, Altrincham, WA14 5NQTel: 0161 926 3641 Email: [email protected] Web: www.datascience.foundationRegistered in England and Wales 4th June 2015, Registered Number 9624670

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 underlyingpattern/model that generates such data. The model derived in this iterative optimizationprocess can be then applied to price prediction using real-world financial data. The mainassumption of this supervised learning model is that if it can explain the past movements ofprices, 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 toone homogeneous market trend (e.g one-week trading period) and the trained model is usedfor the real-world data that falls within the same trend, we can expect the supervised model topredict prices quite accurately. However, supervised models are less efficient in predictinglong-term price dynamics because the hypothesis and data fed to them often reflect transienttrends rather than universal laws. Also, they are often based on the manually engineeredfeatures 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 basedon rigid trading rules and decision thresholds, they fail to react to changing market trends andhave a narrow scope of available investment strategies. That’s where Reinforcement Learning(RL) models can shine.

Page 5: AI in Financial Trading: White Paper

Data Science FoundationData Science Foundation, Atlantic Business Centre, Atlantic Street, Altrincham, WA14 5NQTel: 0161 926 3641 Email: [email protected] Web: www.datascience.foundationRegistered in England and Wales 4th June 2015, Registered Number 9624670

Reinforcement Learning (RL) to Develop a Sophisticated Trading Policy

The development of the AI-based agents with a flexible and automatically adjustableinvestment 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.gGo and chess)

In a conventional RL model, we have an agent (e.g algorithm) that acts in the environment thatcontinually emits certain rewards and punishments for the agent to refine his behavior. Basedon this feedback, the agent evaluates the success of a particular action (e.g selling or buying astock) and gradually adjusts its policy to become more efficient. At the end of the day, byexperimenting with the environment and evaluating its feedback, the RL agent is able to comeup with the optimal policy framework or strategy.

As it turns out, using this self-learning potential of RL agents in financial trading, we candevelop more nuanced and sophisticated learned policies that enable more accurate and timelystrategies 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 andaccumulated experience. For example, an RL agent can dynamically change a high-frequencytrading strategy for the medium or low-frequency trading and vice versa, decide on the volumeof 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 learnshow to behave by experimenting with its environment (e.g stock market) continuously refining

Page 6: AI in Financial Trading: White Paper

Data Science FoundationData Science Foundation, Atlantic Business Centre, Atlantic Street, Altrincham, WA14 5NQTel: 0161 926 3641 Email: [email protected] Web: www.datascience.foundationRegistered in England and Wales 4th June 2015, Registered Number 9624670

its strategies and fixing past errors.

The RL approach discussed above can be further enhanced by combining RL with powerfulDeep Learning (DL) architectures that enable learning of complex non-linear hypotheses fromunstructured data. The conjunction of RL and DL can produce investment policies and rulesmore powerful than any human trader could possibly formulate relying solely on hisknowledge, intuition, and experience.

RL for Modeling Other Trading Agents

As we’ve said, Reinforcement Learning (RL) has been widely used in solving board games likechess or Go. Over the past few years, RL models such as AlphaGo and AlphaZero invented bythe Deep Mind company acquired by Google Inc. outperformed all existing game engines in thegames of chess and Go displaying a fantastic level of strategic thinking that goes beyond bruteforce and dynamic programming approaches of the past. A great success achieved by RLmodels in board and computer games owes to their powerful ability to act in simulatedenvironments 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 ofother agents has been always regarded as a powerful advantage. However, the enormous sizeand the ‘black box’ nature of the stock market pose challenges which are hard to address usingtraditional game-theoretic approaches. However, as it turns out, the ability to learn throughtrial-and-error and generate one’s own experience make RL agents powerful in understandingpossible motivations of other stock traders. In particular, RL models can identify variousmarket signals that emerge from their trading decisions and understand whether they areattributable to the market response of other agents. Such usage of RL is a promising field ofresearch 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 andimage recognition, machine translation, and Natural Language Processing (NLP). The maindifference between DL and supervised learning is in the use of feature learning orrepresentation learning instead of manually engineered features. In feature learning, the

Page 7: AI in Financial Trading: White Paper

Data Science FoundationData Science Foundation, Atlantic Business Centre, Atlantic Street, Altrincham, WA14 5NQTel: 0161 926 3641 Email: [email protected] Web: www.datascience.foundationRegistered in England and Wales 4th June 2015, Registered Number 9624670

model automatically extracts meaningful features from data and creates multiple layers ofabstraction to represent this data. Such an approach is motivated by the fact that unstructureddata such as images, audio, video or speech is hard to define in terms of the manuallyextracted features. The same is true of the financial charts data for technical analysis whichcan contain hidden features not known by the researcher before the formulation of the MLmodel. The solution is to let the intelligent machine find those features automatically andderive more efficient and non-linear models which are hard to formulate using underlyingtheories 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. Interms of trading, such an approach allows for the recognizing of long-term trends indata, identifying hidden patterns, emerging trends and market signals, and finding thecorrelation between different investment assets.DL models can learn multiple knowledge representations that correspond to differentlevels of abstraction. This feature is especially useful in representing complexunstructured knowledge like language, reasoning, and financial time series data.DL models display great performance on large data sets such as financial time seriesdata. Marrying supervised price prediction with DL architectures like LSTMs (LongShort-Term Memory Units) or RNNs (Recurrent Neural Networks) can enable us tobetter predict long-term movements of prices.Financial markets are hard to predict due to occasional market shocks and black swanevents. 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 improvefinancial 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 constructbetter predictive models that incorporate both technical and non-technical marketanalysis.

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, CNNsimitate human visual cortex in which cortical neurons respond to stimuli only from restricted

Page 8: AI in Financial Trading: White Paper

Data Science FoundationData Science Foundation, Atlantic Business Centre, Atlantic Street, Altrincham, WA14 5NQTel: 0161 926 3641 Email: [email protected] Web: www.datascience.foundationRegistered in England and Wales 4th June 2015, Registered Number 9624670

regions of the visual field known as the receptive field. These receptive fields of differentneurons partially overlap covering the entire visual field. Modeling this structure, the CNNslayers and neurons are designed as receptive fields that gradually move from the low-levelregions and features like points and angles to abstract geometrical objects that representhigher levels of abstraction. In this way, CNNs breaks an image into multiple overlappingperceptive fields and then runs multiple filters through them to extract complex features andpatterns.

Since financial time series are images too, we can apply CNNs to find patterns and features inthem, which could tell us more about future price movements and trends. For example, asAshwin Siripurapu did, we can develop a CNN with filters sensitive to short-term markettrends and then join them with filters that focus on the greater part of the financial time seriesimage which represents long-term trends. In this way, we can pide financial charts intomultiple layers and perceptive fields that correspond to different patterns in financial datareflecting both short-term and long-term trends. Treating financial charts as raw images withpatterns to be recognized is, indeed, a revolution in technical analysis that previously relied onstatistics and probabilistic methods.

AI for Stock Ranking

These days, there are over 630,000 companies traded publicly all over the world. Theabundance of stocks, bonds, and equities and the presence of thousands of hedge funds

Page 9: AI in Financial Trading: White Paper

Data Science FoundationData Science Foundation, Atlantic Business Centre, Atlantic Street, Altrincham, WA14 5NQTel: 0161 926 3641 Email: [email protected] Web: www.datascience.foundationRegistered in England and Wales 4th June 2015, Registered Number 9624670

competing for revenue, makes deciding upon the right investment target more complicatedtoday than ever. Human traders are struggling to make sense of the non-stop flow of news andfinancial 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. Stockranking 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 stockrankers can use perse types of data such as financial time series data, technical indicators (e.gcandlestick patterns), SEC filings, corporate reports, news, and social media posts. Inparticular, Deep Learning allows for the integrating of these perse types of structured andunstructured data into one model. Putting these types of data together and powering themwith neural networks yields powerful prediction models that can identify the best candidatesfor investment. The main benefit of the ML stock ranking models is their ability to takenumerous economic and extra-economic factors into account and learn non-linear features ofstock 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 studiesefficient combinations of stocks to generate the highest returns while keeping risks to aminimum. Until very recently, the central paradigm of portfolio management was ModernPortfolio Theory (MPT) according to which there is an optimum strategy for a given portfoliothat maximizes returns at a given level of risk. However, recent advances in Deep Learningand Reinforcement Learning are revolutionizing conventional approaches to portfoliomanagement and risk management.

In particular, advances have been made in the ML-based portfolio persification. AI stockadvisors 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 algorithmidentifies stocks with different risk premiums and return potential and builds an efficientpersification strategy for inpidual stocks, industries, and geographies. By adding risk measuresinto the equation, the algorithm ensures that stable returns are secured while losses are keptto a minimum.

One of the most promising AL techniques used for the algorithmic learning of persificationstrategies 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 riskpremium. For each studied asset, the model creates a portfolio weight which determines how

Page 10: AI in Financial Trading: White Paper

Data Science FoundationData Science Foundation, Atlantic Business Centre, Atlantic Street, Altrincham, WA14 5NQTel: 0161 926 3641 Email: [email protected] Web: www.datascience.foundationRegistered in England and Wales 4th June 2015, Registered Number 9624670

many stocks of this type should be kept in the portfolio for the upcoming trading period. If thetarget weight of an asset increases, the RL agent would buy an additional amount of it and sellif the weight decreased. At the same time, the RL agent would take various risk metrics suchas Sharpe ratio into account to ensure that the proper balance between high-risk and low-riskstocks is achieved. It will also ensure that assets are persified by asset type and economysector. The discussed RL model is highly adjustable and dynamic – the RL agent constantlyrefines its policies using the model’s feedback to develop more sophisticated persificationstrategies. It also keeps the memory of previous states in Portfolio Vector Memory (PVM) layerthat allows the agent to take the effect of transaction costs and various extra-market factorsinto account.

Evaluating Market Sentiment with Natural Language Processing (NLP)

Price prediction is usually based on three types of analysis: technical analysis, fundamentalanalysis and the study of the market sentiment. While the methodology for technical andfundamental analysis has been substantially improved over the past four decades, the analysisof market sentiments has been traditionally regarded as the field where intuition and educatedguesses played a greater role than science. As a result, until recently, we were limited in ourability to explain the dynamic of market sentiment. However, with recent advances in NaturalLanguage Processing, we can now make a significant progress in the understanding of varioussubjective variables like risk-averse or risk-seeking behavior, investor confidence, andpsychological factors that drive the arrival of bearish or bullish markets. In particular, we canuse the sentiment analysis with RNNs and built-in memory mechanisms to evaluate thesentiment (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 thatrepresent the semantic proximity of words. The NLP algorithm can then use these vectors tostudy the sequence of text (e.g blog post) identifying ‘positive’ and ‘negative’ signals/words andcomparing them with the previous signals stored in memory. During this process, thealgorithm will gradually adjust ‘positive’/’negative’ scores calculating the probability of theentire 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 marketsentiment in a given period. Thus, NLP can become a powerful tool for identifying thechanging market trends and the impact of news on the trajectory of the market.

Summary

Page 11: AI in Financial Trading: White Paper

Data Science FoundationData Science Foundation, Atlantic Business Centre, Atlantic Street, Altrincham, WA14 5NQTel: 0161 926 3641 Email: [email protected] Web: www.datascience.foundationRegistered in England and Wales 4th June 2015, Registered Number 9624670

As we’ve seen, recent advances in Artificial Intelligence are drastically reshaping the financialtrading industry. In particular, with Deep Learning and Reinforcement Learning, we canalready create intelligent agents capable of developing sophisticated trading strategiesthrough experimentation and trading experience. These strategies are much more flexible andnuanced than conventional hard-coded rules and even dynamic programing approaches.Similarly, with the advances in Convolutional Neural Networks, investors have an opportunityto identify hidden signals and trends in financial graphical data and convert the acquiredknowledge into more efficient investment decisions. Advances in AI-based price prediction andtechnical analysis are matched by the important breakthroughs in the sentiment analysis,which allows us to identify important subjective variables of market behavior in unstructureddata like blog posts, consumer feedbacks, and market reports. Combining conventionaltechnical analysis with the analysis of market sentiment has a promise of opening a new epochof Artificial General Intelligence trading in which intelligent AI agents are endowed both with apower of rational reasoning and intuition and the unmatched faculty of prediction and patternrecognition.

Page 12: AI in Financial Trading: White Paper

Data Science FoundationData Science Foundation, Atlantic Business Centre, Atlantic Street, Altrincham, WA14 5NQTel: 0161 926 3641 Email: [email protected] Web: www.datascience.foundationRegistered in England and Wales 4th June 2015, Registered Number 9624670

About the Data Science FoundationThe Data Science Foundation is a professional body representing the interests of the DataScience Industry. Its membership consists of suppliers who offer a range of big data analyticaland technical services and companies and individuals with an interest in the commercialadvantages that can be gained from big data. The organisation aims to raise the profile of thisdeveloping industry, to educate people about the benefits of knowledge based decision makingand to encourage firms to start using big data techniques.

Contact Data Science FoundationEmail:[email protected]: 0161 926 3641Atlantic Business CentreAtlantic StreetAltrinchamWA14 5NQweb: www.datascience.foundation