Alpesh Patel has been experimenting with ChatGPT’s ability to pick good stocks from the NYSE and Nasdaq. He found that with the right prompts and correct data, it could make phenomenal choices. But it’s not just something you can flick on, there is a process. The race for the latest and greatest technology for trading stocks accelerated when the US Securities and Exchange Commission approved electronic communications networks (ECNs), or computers, that allowed traders to buy and sell securities without going through a stock exchange in 1998.
Since then, fund managers, investors, and traders alike have hunted down the best tools to gain an edge in the market.
Alpesh Patel, the CEO of a private equity firm called Praefinium, jumped on this bandwagon nearly two decades ago. In 2004, he created a proprietary stock-scoring and picking algorithm that became a plugin in ShareScope, a stock-data terminal. His tool called the Alpesh Patel Special Edition, returned up to 1,214% from its inception until 2021, according to ShareScope. Its benchmark, the FTSE All-Share index, was up 92% for the same period.
Now, artificial intelligence is adding another layer of technology that gives investors and traders a new tool. Patel is jumping on it, too: he has been experimenting with ways to use ChatGPT’s large language model to optimize the stock-picking process.
In a previous interview with Insider, he shared preliminary findings from two tests he ran using GPT-4’s LLM. One was a walk-forward test that asked the LLM to pick five stocks it expected would do well in 2022 since it only had data up until 2021. The second was a real-time test that asked for forward-looking stock picks expected to do well over the next 12 months. He fed the LLM data from a terminal and asked it to filter its findings through top academic literature and fund managers.
“What we really wanted, which we didn’t get, and I guess you couldn’t get, is some crystal ball which looked into the future and said, ‘here are the stocks which are going to do fantastically well over the next 12 months,'” Patel said. “And that’s the mistake people are making. They’re thinking that’s what AI is going to give them. And of course, it can’t do that.”
The main findings from the initial experiments were that GPT-4 could do two things: confirm your homework, and tell you something you might otherwise have missed based on the data you imputed. Another thing he learned was that getting the prompt right was one of the most critical steps.
Patel continued his experiments with that new frame of awareness.
Building on the knowledge In his earlier experiments, Patel and his team manually pasted increments of stock data into ChatGPT’s text box. This limited how much data could be used. In a more recent experiment, he used Julius AI, a tool that connects with spreadsheets and can interpret and analyze information using LLMs like GPT-4. Using Julius AI, Patel was able to input data for over 6,800 stocks to see if the outcomes or accuracy would change.
The stocks and funds uploaded were all those listed on the Nasdaq and the New York Stock Exchange. The metrics Patel chose to input were based on company fundamentals that he felt were important when picking stocks. The data included the Alpesh value/growth rating which is a proprietary score out of 10 for companies based on weighing their valuations (share price/earnings), growth, dividend yields and price momentum, cash return on capital invested (CROCI %), Price % 6 months ago, Sortino Ratio, Return Alpha %, volatility %, and PEG, among others.
He then asked ChatGPT’s LLM via Julius.ai to select names it expected would do well in the following six months to June.
Prompt:
As a knowledgeable stock market analyst with expertise similar to Warren Buffett, your task is to analyze the given data and provide recommendations for the top 10 stocks to invest in. Please consider the following guidelines for your response: 1. Base your recommendations on thorough analysis and understanding of the literature and factors that influence stock markets. Incorporate your knowledge of market trends, company fundamentals, and investor sentiment. 2. Evaluate the given data carefully, considering factors such as financial statements, historical performance, industry trends, and any other relevant information that may impact the stocks’ potential. 3. When providing your recommendations, explain your reasoning behind each selection, highlighting key indicators or factors that support your decision. Consider discussing the stocks’ growth potential, competitive advantages, and any risks or challenges they may face. Please note that while you should aim to provide the best 10 stocks based on your analysis, the stock market is complex and subject to volatility. Your recommendations should be well-reasoned and grounded in data, but remember that investing always carries some level of risk.
Response:
Based on the criteria that Warren Buffett might use for stock selection, here are the top 10 stocks to invest in:
Broadcom Inc
Cisco Systems Inc
Patel then requested eight more names to meet his initial request of 10 stocks but the LLM responded that it could not provide them because only two of the companies met his filtering criteria.
Prompt:
I want you to look at all the data columns and using not just What Warren Buffett may consider important, but the leading academic literature on stock price movements, as well as weighing these factors or metrics by their importance in the data, tell which 10 are the best stocks for the next 6 months.
Response:
Based on a weighted score that takes into account various metrics and their importance according to leading academic literature on stock price movements, here are the top 10 stocks for the next 6 months:
Apple Inc
UnitedHealth Group
Johnson & Johnson
Exxon Mobil Corp
Visa Inc
Tesla Inc
Walmart Inc
Taiwan Semiconductor Manufacturing
Procter & Gamble Co
Eli Lilly & Co
The average return between January to June on these stocks was 23.20%.
When Patel requested it expand the list to 20 stocks, it added:
Chevron Corp
Mastercard Inc
Home Depot Inc (The)
Pfizer Inc
AbbVie Inc
Merck & Co Inc
Coca Cola Co (The)
Pepsico Inc
Broadcom Inc
Alibaba Group Holding Ltd
This brought the overall gains down to nearly 12%, primarily dragged down by a 28.5% drop in Pfizer’s stock.
Below each response, Julius AI posts Python code that demonstrates how the output was calculated. Based on the visible equation, the LLM created a proprietary scoring system that weighted the sum of each metric to reflect their importance according to “leading academic literature on stock price movements.” It used a two-level scoring system giving metrics such as the Alpesh value/growth rating and CROCI a 0.05 higher weighting than other metrics such as volatility or market cap.
Patel also realized that reviewing how the LLM calculates its output is a crucial step in the process because an incorrect formula could lead to a different list of stocks which may not be as satisfactory. Rahul Sonwalkar, the founder of Julius AI noted that the tool has a broad knowledge of complex algorithms from forecasting to regression, and it can apply them to massive data sheets within seconds. The program can attempt to tackle a problem from different angles.
When Patel asked it to use a more sophisticated weighting system, it suggested using further machine learning that could help it determine the optimal weights for each metric.
Comparably, Patel had a list of 69 stocks he manually picked from the same spreadsheet that met his criteria. They averaged a 20.54% return between January to June. However, he had placed a 25% theoretical stop loss on all positions, which limited losses on stocks that fell further in price. This is the standard percentage he uses in his real-life strategy.
Patel concluded that whether it’s a human analyst or AI that’s picking stocks, there are no guarantees in the stock market.
Regarding ChatGPT’s ability to make stock selections, there is a lot more work and testing that need to be done, including feeding it more data on each stock.
Overall, Patel says it had some “phenomenal” stock picks — yet, this is not something which you just flick on, he said.
“If you are willing to get the data, ask the questions and put it into something like this: you’ve got the stock picks, you’ve got the answers. You can basically replace a fund manager if you want,” Patel said.