(update January 29, 2021 — after Reddit users claim victory as $13bn hedge fund capitulates on ..) I added a false negative example — see the last colaboratory notebook below — and be careful when using off-the-shelf code!
A very hyped use of AI in Finance comes from the application of Sentiment Analysis as a factor to predict the future price of a security.
Below I will explain some of the basics and caveats of using it in a financial context.
Sentiment analysis can be defined as:
“Sentiment analysis, or opinion mining, is an active area of study in the field of natural language processing that analyzes people’s opinions, sentiments, evaluations, attitudes, and emotions via the computational treatment of subjectivity in text. “
A simple introduction to it can be found in “How Quant Traders Use Sentiment To Get An Edge On The Market”, and typical academic papers explaining in full detail the process are “Twitter mood predicts the stock market.” and “Stock Prediction Using Twitter Sentiment Analysis”.
The basic idea is the following:
- convert a pipeline text sources (news, twitters, posts) into one or many quantitative (numerical) values,
- feed the above values into a complex model (classical econometrics or newly developed neural networks) as input to predict the price of a security.
If you did open one of the academic papers, you would have been drowned in jargon, but by now big companies like Bloomberg and new companies like RavenPack have jumped on the bandwagon and now provide Sentiment Analysis indices as utilities: “How you can get an edge by trading on news sentiment data” and “Abnormal Media Attention Impacts Stock Returns”.
As in the previous posts, on one hand I prefer to produce reproducible research in the form of jupyter notebooks that actually run (instead of pdf papers like the links above), but in this case the complexity is such that I only will illustrate basic concepts.
(An example with the full code is availabe at this colaboratory notebook)
Some issues with Sentiment analysis in Finance
It turns out that this off-the-shelf tool is not great for financial results (and that is only after checking 2 simple cases). Some additional problems:
- Sentiment analysis is very ‘domain specific’ (academic talk to say that a set of tools only works in a pre-defined context – so you need to find the correct one for your applications)
- Regime changes can happen – if you keep using ‘old’ models for current data you will miss opportunities: think what happens if you use use pre-2013 models (before HODL for cryptocurrencies entered the cybersphere) – in fact, if you look at Vaders lexicon data you will not find ‘hodl’.
- as the ‘Jio’ example shows, a piece of news can be very negative but the price impact can be muted (that particular piece of news is very negative but is also a laggard indicator as the price already tanked).
Instead, we can:
Create our own sentiment tool.
The Vader guys:
” collected intensity ratings on each of our candidate lexical features from ten independent human raters (for a total of 90,000+ ratings).”
Instead of using their “lexical features”, we would have to design and implement a system to collect the ratings of something close to 90k (the more the merrier) in a business context (create a user interface). I could not find a publicly available corpus of annotated financial news (financial news with a score).
Also, if we are training in our own we could change the numerical measure to reflect directly the impact on the stock.
Connecting to relevant (and timely) news pipeline: assuming the sentiment tool is ok, we would need to connect it to a set of reliable news and relevant comments (no fake news, or add a fake news analyser).
Use Professional sentiment indicators
I mentioned above some sentiment analysis providers. The good thing is that the platforms handle the whole data connection. Unfortunately, their systems are proprietary (blackest black box of all):
- so we cannot test whether their sentiment tool is finely tuned to our specific financial topics (or generic business topics),
- we cannot control how often they update them,
- are available to competitors, hence the alpha they can provide will diminish in time.