Stock earnings call analysis

Shyam BV
DataDrivenInvestor
Published in
3 min readAug 26, 2021

--

Background

For each listed stock, there is a press release for every quarter or year. Lots of talks about it. This article will show the sentiment analysis on the earnings call, highlight the points for analysts or investors, and make it easy to digest.

Photo by Geron Dison on Unsplash

Analysts or investor a spends a ton of time to understand about the context of spokesperson. Won’t it be easy if we highlight them? This article will discuss retrieving an earnings call, parse it, apply transformer models, and highlight the text based on sentiment.

Setup and API

We are going to involve with earnings calls and transformers. Below are the packages we need with other standard packages.


pip install transformers==4.9.2

We also need a developer account with API keys for financialmodelingprep. It is a great tool to access stock-related data.

Fetch earnings call

Here you have two options to fetch the earnings call. Goto SEC website and write some code to scrape it or use financialmodelingprep to get it. Not all the tickers are available here.

Retrieve earnings call

It should return below the transcript.

Sentiment of transcript

After we retrieve the transcript, we can perform a different kind of sentiment analysis using transformer models.

  1. They are fine-tuned for financial data, which is called FinBERT.
  2. Use regular sentiment model
  3. Use ensemble of these two models.

FinBERT

I will let you read through this link to understand more about it. Below is the code to use it.

FinBERT sentiment

Regular sentiment model

Another sentiment model which can be used is the Roberta base model, which is shown here. We can use any sentiment model here. To read more about it, check out here.

Ensemble model

We can combine two models, get the results from both models, and use them in the text.

Ensemble model and gets both the results

Results

After parsing through the entire text, I have applied positive sentiment to green and negative sentiment to red.

Final Results — Source author

There is still some room for improvement by removing common words like Thank you, good, etc. But overall, it gives us good results to an investor and analyst. So they don't need to read through thousands of pages to understand it.

NER reorganization

We can also get the NER from the transcript to understand where the company is mainly focused on.

NER recognition
NER without person

Conclusion

  1. We have seen how to get the earnings to call data from API.
  2. Read and parse the text.
  3. Create different sentiment models.
  4. Perform NER on the earnings call to get other entities.

References:

  1. https://medium.com/code-sprout/twitter-reddit-stock-sentiment-using-transformer-model-49026812b2a8
  2. https://huggingface.co/cardiffnlp/twitter-roberta-base-sentiment
  3. https://huggingface.co/yiyanghkust/finbert-tone

Get Code

Please subscribe to my newsletter to get the complete working code for my articles and other updates.

--

--