Inspiration

When we want to buy a stock, we often need to check the history of the prices, the trend, various factors including many details about the financial position of the company, the background of the industry etc. What if all this information can be presented and visualized in an easier way? What if we utilize machine learning to predict the future stock prices? We decided to build a tool that can guide us to become a successful trader.

What it does

This tool essentially summarizes information about the popular stocks; it also forecasts the stock price and gives advice based on latest financial news from the market.

How we built it

We built it by using several python libraries, and these were streamlit (For creating the website and the interactive features), datetime (For finding the exact date and time of stocks), yfinance (Which displays the stock market currently), fbprophet (Which is used to predict the behavior of certain stocks), and plotly(Which displays interactive graphs). The app allows users to input a stock ticker and select a date range using Streamlit's interactive widgets. The app then fetches historical stock data using the yfinance library, which is downloaded based on the specified ticker and date range. Next, the data is preprocessed and formatted for use with Prophet, a time series forecasting model, which predicts future stock prices based on the historical data. The model's predictions are made for the next year, and confidence intervals are generated alongside the forecast. Plotly is used to create interactive visualizations, displaying both the historical stock prices and the predicted future prices, with shaded areas representing the confidence intervals. We also added an integrated AI component that uses the OpenAI API. The app is deployed via Streamlit, allowing users to easily explore the predictions and visualize stock trends in an interactive, user-friendly interface.

Challenges we ran into

One of the biggest initial issues that two members of the team faced was related to the installation of frameworks. Prophet turned out to be very difficult to download using a Windows command prompt as it needed the Cython module to run. However, this issue was fixed by use of the Oracle VirtualBox emulator, which meant that all frameworks would run in the same place. Another challenge we ran into was the different opinions between team members, which made the merge of the two versions difficult.

Accomplishments that we're proud of

  • We're proud of the proper handling of time-series data, considering factors like missing data points, outliers, and periodicity (daily, weekly, monthly), accomplished by the datetime framework.
  • We successfully used the OpenAI API to improve our financial analysis
  • We utilized GitHub throughout the project to communicate our ideas and work collaboratively
  • Finally, we're proud of how we implemented dynamic charts and graphs (By use of Plotly) to allow users to visualize stock price trends, model predictions, and other relevant metrics in real-time.

What we learned

We learned that no matter how advanced our model was, bad data led to poor predictions. Spending time on data cleaning—handling missing values, outliers, and feature engineering—was essential to get good results. Good data is the foundation; without it, nothing else works.

What's next for StockSense

The future of stocksense is related to ChatGPT. Next, we will use the openAI API (Used for GPT models which are nlp chatbots) to have AI predict trends in stock prices and values over time. This will provide a second alternative method of predictions for users and can be made more user friendly, assisting with exact requests.

Built With

Share this project:

Updates