HISTORICAL RESEARCH

Sentiment Analysis in Finance

This historical article is reproduced from the original export. Some images and interactive elements are unavailable in this edition.

(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:

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:

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):