AI Stock Price Predictions For The Everyday Investor
Accurately predicting future stock prices is a challenging task. If you get it right, you can make a lot of money.
This article covers the following.
Whether you need AI for long-term buy-and-hold investing
A few ways researchers use AI to predict future stock prices
Why Google Sheets is a good tool for everyday investors to know
How does predicting stock prices make you more money?
If you know where the stock price will be in the future, you can time when to buy shares before the price rises, when to sell shares before the price drops, and when to sell covered calls and secured puts.
Do long-term buy-and-hold investors need AI stock predictions?
Long-term buy-and-hold investors do not need sophisticated AI stock prediction tools to make lots of money.
Buy shares of companies that have a great track-record and a strong long-term future as a business.
Then just hold onto the shares for a long time. At least 3 years if not 5 years, 10 years, or longer.
You need patience, confidence, and decent stock-picking abilities, not AI.
AI tools surely are useful for financial applications, like high-frequency algorithmic trading, cyber security, and hedge fund-type stuff.
Indeed, AI could be good at long-term buy-and-hold investing.
But that is not the question.
The question is whether AI tools can help the everyday long-term buy-and-hold human investor.
Surely many AI-based tools exist for the everyday investor.
The good ones are probably simple AI tools that help long-term buy-and-hold investors get an edge.
For instance, I can imagine a simple AI tool that helps identify opportunities to buy more shares of a good company at lower prices.
What if you could get a 10% discount every time you bought shares just because you waited to buy until a predictable and temporary 10% price fall?
That would be nice.
Another example is using AI to compare two companies you love in 3 years, 5 years, 10 years, or longer to predict which one is more likely to grow bigger.
Imagine if you could know that one company is more likely to triple in value in 5 years than another.
That could help you allocate your money or choose companies to invest in.
You do not need AI tools to pick great companies, allocate money, and otherwise stack the odds in your favor.
But a combination of AI tools, good techniques, and human experience could make for a powerful combination.
How are AI researchers predicting stock prices?
For everyday investors, we can look to the AI pros to better understand how to use AI to predict stock price movements.
Because AI is a broad field, it is not enough to know that people use artificial intelligence for predicting stock prices.
It is important to know how experts use AI to predict future stock prices.
Two techniques to know about are the following.
LSTM + Sentiment analysis
Financial question and answering systems
LSTM + sentiment analysis research
One potentially promising approach to predict future stock prices that AI researchers are pursuing combines LSTM and sentiment analysis.
Sentiment analysis is a technique used to analyze whether the meaning of a written text has a specific sentiment. Examples of sentiments are positive, negative, hateful, or funny.
For instance, you train a model using a huge database of analyst reports with each report marked by a human as having a sentiment of buy, hold, or sell.
After training the model on that data, you can feed the model a new analyst report, and the model will tell you if the report recommends buy, hold or sell.
One promising pre-trained model for sentiment analysis fine-tuned for the financial sector is named Financial Bert.
Try it out at Hugging Face on the right side of the page.
You feed text like a financial news headline as input to Financial Bert.
Financial Bert returns results that classify the text into financial categories with confidence levels for each predicted category.
Example categories include whether the stock in the text rose, fell, rebounded, dropped, and other financial categories.
You can use the category predictions to understand the meaning of the input text.
Financial Bert is trained on a large corpus of financial texts.
TRC2-financial: 1.8M news articles published by Reuters between 2008 and 2010
Bloomberg News: 400,000 articles between 2006 and 2013
Corporate Reports: 192,000 transcripts (10-K & 10-Q)
Earning Calls: 42,156 documents.
Financial Bert could be useful for automating time-consuming tasks for investors, like distilling down large volumes of financial text into easy-to-digest stock recommendations or looking for specific financial signals in the text.
Sentiment analysis is useful for more than just financial information.
If you want hands-on ways to learn about sentiment analysis . . .
Check out this example from Hugging Face of a model trained on 58 million Tweets for sentiment analysis.
Check out the robust tutorial from Google’s Tensorflow platform that uses the IMDB movie review dataset to teach basic text classification for sentiment analysis.
As for LSTM . . .
LSTM is a technique for predicting the next item or sequence of items in a series based on historical data. This is called times-series forecasting.
For instance, LSTM can be used to train a model based on the closing price for a stock for each trading day in the last 10 years.
After training the model, you ask it to predict the closing price for the next date or series of dates in the data set.
LSTM can be useful for predicting the price for the next day, in 3 months, or some other specific time. You can also use them to identify trends or changes in stock prices over time.
LSTM stands for long short-term memory neural network.
Want hands-on ways to learn about LSTM time-series forecasting?
Check out the robust tutorial from Google’s Tensorflow platform that uses a weather dataset to teach machine learning for time-series forecasting.
You can also try this official Google Colab notebook from Keras using LSTM for predicting the next character for text generation.
I cannot find good examples of pre-trained financial LSTM prediction models for the everyday investor to use.
Maybe the good pre-trained LSTM models are not open source or maybe I just have not found them yet.
As for predicting stock prices, neither sentiment analysis alone nor LSTM alone are perfect predictors.
As for both, long time horizons are very difficult to accurately predict for. Predicting a stock price in 3 months, 12 months, or longer can be difficult.
Among several reasons sentiment analysis alone is not enough to predict stock prices is investor sentiment is not the only factor that influences stock price.
Among several reasons LSTM alone is not enough to predict stock prices is investor sentiment has such a big influence on stock price and does not always follow the data that the LSTM model is trained on.
By combining the two, however, AI researchers are creating more accurate models for predicting future stock prices.
In 2022, a group of AI researchers published a paper using Twitter sentiment analysis with deep learning-based LSTM to train a stock prediction model.
The 2022 researchers built a model with a maximum precision of 95.33%, a recall of 85.28%, and an F-score of 90%.
Those are really good scores. They report that their model surpassed previous techniques.
Swathi, T., Kasiviswanath, N. & Rao, A.A. An optimal deep learning-based LSTM for stock price prediction using twitter sentiment analysis. Appl Intell 52, 13675–13688 (2022). https://doi.org/10.1007/s10489-022-03175-2
To learn more about LSTM + Sentiment Analysis for predicting stock prices, start with a 2019 paper that other papers cite to a lot, and then read the papers that cite it.
Jin, Z., Yang, Y. & Liu, Y. Stock closing price prediction based on sentiment analysis and LSTM. Neural Comput & Applic 32, 9713–9729 (2020). https://doi.org/10.1007/s00521-019-04504-2
My takeaway for the everyday long-term buy-and-hold investor . . .
LSTM + Sentiment analysis could be good tools to supplement but not yet replace human investment decisions.
Keep a lookout for new and improved pre-trained financial models that you can use as an everyday investor.
Financial question and answering systems: FinBERT-QA
Question and answering systems use natural language processing and information retrieval to generate answers to questions.
Trained on large sets of actual questions and answers, Q&A models take a question as an input and return an answer.
FinBERT-QA is a financial question and answering model fine-tuned for answering financial questions
To give you an idea of what the FinBERT-QA model is trained to answer, here is an example Q&A from the FinBERT-QA training data.
Question: Why are big companies like Apple or Google not included in the Dow Jones Industrial Average (DJIA) index?
Answer: That is a pretty exclusive club and for the most part they are not interested in highly volatile companies like Apple and Google. Sure, IBM is part of the DJIA, but that is about as stalwart as you can get these days. The typical profile for a DJIA stock would be one that pays fairly predictable dividends, has been around since money was invented, and are not going anywhere unless the apocalypse really happens this year. In summary, DJIA is the boring reliable company index.
In addition to the example above, you can ask the FinBERT-QA model questions like the following.
Getting financial advice: Accountant vs. Investment Adviser vs. Internet/self-taught?
Are individual allowed to use accrual based accounting for federal income tax?
What are 'business fundamentals'?
How would IRS treat reimbursement in a later year of moving expenses?
Can I claim mileage for traveling to a contract position?
Tax planning for Indian TDS on international payments
Should a retail trader bother about reading SEC filings
Why are American Express cards are not as popular as Visa or MasterCard?
Why do companies have a fiscal year different from the calendar year?
Are credit histories/scores international?
Although the FinBERT-QA model is not fine-tuned specifically for predicting future stock prices, it is nonetheless interesting for at least the following reasons.
The FinBERT-QA techniques are possibly useful as part of a larger stock price prediction model
You can use FinBERT-QA to learn about money issues and become a better investor generally
FinBERT-QA is trained on task 2 of the FiQA dataset containing opinionated questions and answers crawled from community QA sites.
Here is an example of the training data from task 2 of the FiQA dataset.
My takeaway for the everyday long-term buy-and-hold investor . . .
Question and answering systems could be good tools to supplement but not yet replace human investment decisions.
Keep a lookout for other Q&A systems that you can use as an everyday investor.
Google Sheets: A Powerful Stock and Options Tool For Everyday People
Free and easy-to-use tools are accessible for everyday investors to help make more money with stock and options.
Google Sheets is one of my favorites.
In addition to the endless functionality Google Sheets offers, you can access stock and other financial easily from within a Google Sheet.
With the data in your spreadsheet, you can use it in calculations, graphs, and tables.
Another reason to love Sheets for finance is that Google will likely add AI tools to Google Sheets.
Google recently added built-in AI tools to the Google Workplace products Google Docs and Gmail. You can probably use them now for stock investing.
I would not be surprised if Google integrates AI tools into other Google Workspace products like Google Sheets.
As a software developer, a third reason to love Google Sheets for finance is you can easily integrate your data and some Google Sheets functionality into your projects.
Check out my video on how to connect your backend code to Google Sheets.
Please like the video and subscribe to the channel.
The End
That is it for this newsletter. Thanks for reading.
What clever applications of AI can you think of for the everyday investor?
What pre-trained financial models do you know of?
Let me know what you think about AI for investing and how you pick stocks.