A hedge fund manager shares 2 ChatGPT prompts and the AI plugin he used to filter top stock picks
- 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.
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, the race for the latest and greatest technology for trading stocks accelerated.
Since then, fund managers, investors, and traders have sought out the best tools to gain a competitive advantage in the market.
Alpesh Patel, the CEO of Praefinium, a private equity firm, jumped on board nearly two decades ago. He developed a proprietary stock-scoring and picking algorithm in 2004, which became a plugin in ShareScope, a stock-data terminal. According to ShareScope, his tool, the Alpesh Patel Special Edition, returned up to 1,214% from its inception until 2021. The FTSE All-Share index, its benchmark, was up 92% during the same time period.
Artificial intelligence is now adding another layer of technology, providing investors and traders with a new tool. Patel has also jumped on board, experimenting with ways to optimize the stock-picking process using ChatGPT’s large language model.
He previously shared preliminary results from two tests he ran using GPT-4’s LLM in an interview with Insider. One was a walk-forward test in which the LLM was asked to select five stocks that it expected to perform well in 2022 despite the fact that it only had data through 2021. The second was a real-time test that asked for stock picks that were expected to perform well over the next 12 months. He fed data from a terminal into the LLM and instructed 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 that looked into the future and said, ‘here are the stocks that are going to do fantastically well over the next 12 months,'” Patel said. “And that is the error that people are making. They believe that’s what AI will provide them. And, of course, it is incapable of doing so.”
The initial experiments revealed that GPT-4 could do two things: confirm your homework and tell you something you might have missed based on the data you imputed. Another thing he discovered was that getting the prompt correct was one of the most important steps.
Patel kept experimenting with that new frame of mind.
Building on the knowledge
Patel and his colleagues manually pasted stock data increments into ChatGPT’s text box in previous experiments. This limited the amount of data that could be used. In a more recent experiment, he employed Julius AI, a tool that connects to spreadsheets and can interpret and analyze data using LLMs such as GPT-4. Patel was able to use Julius AI to input data for over 6,800 stocks to see if the outcomes or accuracy would change.
All stocks and funds listed on the Nasdaq and the New York Stock Exchange were uploaded. Patel chose to input metrics based on company fundamentals that he felt were important when picking stocks. The data included the Alpesh value/growth rating, a proprietary score out of 10 for companies based on 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 other things.
He then asked ChatGPT’s LLM via Julius.ai to choose names that he thought would perform well in the six months leading up to June.
Prompt:
Your job as a knowledgeable stock market analyst with expertise comparable to Warren Buffett is to analyze the provided data and make recommendations for the top ten stocks to invest in. Please consider the following guidelines when responding: 1. Base your recommendations on a thorough analysis and understanding of the literature and market factors. Use your understanding of market trends, company fundamentals, and investor sentiment. 2. Carefully evaluate the provided data, taking into account factors such as financial statements, historical performance, industry trends, and any other relevant information that may impact the potential of the stocks. 3. Explain your reasoning behind each selection when making recommendations, highlighting key indicators or factors that support your decision. Consider talking about the stocks’ potential for growth, competitive advantages, and any risks or challenges they may face. Please keep in mind that, while you should strive to provide the top ten stocks based on your research, the stock market is complex and volatile. Your recommendations should be well-reasoned and supported by data, but keep in mind that investing is always risky.
Response:
Here are the top ten stocks to invest in based on the criteria Warren Buffett might use for stock selection:
Broadcom Corporation
Cisco Systems Incorporated
Patel then requested eight more names to meet his initial request of ten stocks, but the LLM said it couldn’t because only two of the companies met his filtering criteria.
Prompt:
I want you to look at all of the data columns and tell me which 10 stocks are the best for the next six months using not just what Warren Buffett thinks is important, but also the leading academic literature on stock price movements, as well as weighing these factors or metrics by their importance in the data.
Response:
Here are the top ten stocks for the next six months, based on a weighted score that takes into account various metrics and their importance according to leading academic literature on stock price movements:
Apple Computer Inc.
UnitedHealth Group Inc.
Johnson & Johnson (J&J)
Exxon Mobil Corporation
Visa Incorporated
Tesla Motors Inc.
Walmart Stores, Inc.
Taiwan Semiconductor Manufacturing Co., Ltd.
Procter & Gamble Company
Eli Lilly and Company
Between January and June, the average return on these stocks was 23.20%.
When Patel requested that the list be expanded to 20 stocks, it added:
Chevron Corporation
MasterCard International Inc.
The Home Depot Inc.
Pfizer Incorporated
Inc. AbbVie
Merck and Co., Inc.
Coca-Cola Company (The)
Pepsico Incorporated
Broadcom Corporation
Alibaba Group Holding Ltd
This reduced the overall gains to nearly 12%, primarily due to a 28.5% drop in Pfizer’s stock.
Julius AI posts Python code demonstrating how the output was calculated beneath each response. The LLM developed a proprietary scoring system based on the visible equation that weighted the sum of each metric to reflect its importance according to “leading academic literature on stock price movements.” It employed a two-tiered scoring system, with metrics such as the Alpesh value/growth rating and CROCI receiving 0.05 more weight than others such as volatility or market cap.
Patel also recognized that reviewing how the LLM calculates its output is an important step in the process because an incorrect formula could result in a different list of stocks that is less satisfactory. Julius AI founder Rahul Sonwalkar stated that the tool has a broad knowledge of complex algorithms ranging from forecasting to regression and can apply them to massive data sheets in seconds. The program can attempt to approach a problem from various perspectives.
When Patel asked it to use a more sophisticated weighting system, it suggested that it use additional machine learning to help it determine the optimal weights for each metric.
Patel, on the other hand, had a list of 69 stocks that met his criteria that he hand-picked from the same spreadsheet. Between January and June, they averaged a 20.54% return. He had, however, set a 25% theoretical stop loss on all positions, limiting losses on stocks that fell further in price. This is the standard percentage he employs in his actual strategy.
Patel concluded that there are no guarantees in the stock market, whether the analyst is human or artificial intelligence.
Concerning ChatGPT’s ability to make stock selections, much more work and testing is required, including feeding it more data on each stock.
Overall, Patel claims it had some “phenomenal” stock picks — but this isn’t something you can just turn on, he says.
“If you are willing to get the data, ask the questions, and put it into something like this: you have the stock picks, you have the answers.” “If you want, you can basically replace a fund manager,” Patel explained.