Create a Simple Stock Price Prediction App using ChatGPT


Since its release about 6 months ago, the ChatGPT, a large language model (LLM) from OpenAI, has created lots of excitement in terms of its impact on the society and a whole range of possible uses for it. With the release of GPT-4, many established commentators have expressed serious concerns about the harm that could come out of such AI tools that are characterized as generative AI models. This has resulted in a number of AI researchers suggesting a six month halt on AI research.

Since ChatGPT’s release, many companies and researchers have been playing with its capabilities. It has been used to write essays, emails, and even scientific articles, prepare travel plans, solve math problems, write code and create websites among many other usages. Many companies have incorporated it into their Apps. And of course, Microsoft has integrated it into its Bing search engine. Some new reports have shown ChatGPT to be a great help in answering medical questions for patients as well as providing a second opinion to physicians.

Driven by all the hoopla about ChatGPT and the generative AI, I have been also playing with it, please see my previous posts on this. In this post, I want to show you my interaction with ChatGPT to create a simple app for stock price prediction. My initial prompt, shown below, is to ask for a prediction model that will take the closing price of any given stock and predict its next day’s closing price.

Next, I prompt ChatGPT to give me a solution to download the stock data from Yahoo finance website.

My next prompt is to ask for an app using the above code.

ChatGPT then proceeds to tell me how to run the app.

The first time I ran the app, I got an error message (value error). While looking at the ChatGPT code, I located the error made by ChatGPT. The second argument in reshape should have been 5 and not 1 as the predictor is suppose to look at the five previous values. Once corrected, the app ran without any flaw. So, we can see that ChatGPT can easily simplify our work and make us more productive.

Rate This Post

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.