Stock earnings call analysis
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.
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.
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.
- They are fine-tuned for financial data, which is called FinBERT.
- Use regular sentiment model
- 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.
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.
Results
After parsing through the entire text, I have applied positive sentiment to green and negative sentiment to red.
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.
Conclusion
- We have seen how to get the earnings to call data from API.
- Read and parse the text.
- Create different sentiment models.
- Perform NER on the earnings call to get other entities.
References:
- https://medium.com/code-sprout/twitter-reddit-stock-sentiment-using-transformer-model-49026812b2a8
- https://huggingface.co/cardiffnlp/twitter-roberta-base-sentiment
- 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.