LLM enhanced stock watchlist
This was a project to create a stock watchlist web application with a focus on pulling real-time stock data combined with a large language model (OpenAI GPT4) to provide insights and predictions on recent news articles and stock price movements.
User Interface Design and Reactivity
The stock market dashboard features a user-friendly interface developed with React.js and a stylized component library, designed to display stock prices in a clear and easily understandable format.
The dashboard updates in real-time, ensuring users have access to the latest stock price information. Implementing basic error handling and user feedback mechanisms, such as notifications for adding stocks to the watchlist, enhances the user experience.
The interface is modular and well-documented, allowing for easy maintenance and future enhancements.
Real-Time Stock Data Retrieval
To provide users with up-to-date stock price information, the application integrates a real-time data streaming mechanism. This is achieved through either a WebSocket connection via a free stock API for realtime data (Finnhub.io).
The backend, built with Node.js, fetches current stock prices through RESTful APIs and streams the data to the frontend, and stores it in a local SQL database. This ensures that the stock dashboard displays the latest prices without the need for manual refresh and allows for efficient retrieval and management of stock data from the local database.
API Development and Database Management
The backend of the application includes RESTful APIs for handling stock data. These APIs enable fetching current stock prices and adding new stocks to a watchlist stored in a SQL database.
The database schema stores stock symbols and related information, such as the added timestamp, company name, and price. SQL queries are used to create the necessary tables and retrieve the list of stocks from the watchlist, facilitating seamless interaction between the backend and the database.
LangChain and OpenAI Chat Agent
LangChain is a tool that makes it easier to use language models like ChatGPT with other APIs and services. It helps create AI solutions that can understand and respond to natural language queries via a chat interface.
The application leverages LangChain to enable OpenAI's language model to access real-time news and stock information from Google using the SERP API. The AI chat agent can provide stock recommendations, answer questions, and help manage the watchlist.
Project outcomes
The stock market dashboard project successfully achieved real-time data integration and user-friendly interaction, providing users with up-to-date stock prices and news, and enhancing the overall user experience with AI-powered chat assistance.