One of my investment strategies focuses on trading based on companies undergoing stock splits. This involves manually researching upcoming stock splits on financial websites and reviewing the 8-K/10-K filings of these companies. To streamline these tasks, I developed a bot that automatically identifies upcoming stock splits, retrieves the relevant documents from the U.S. Securities and Exchange Commission (SEC) website, processes the information using a LLM, and notifies me accordingly. I initiated this project with a friend who assisted with the Discord code, database, and web UI development. While I realize I may have spent more time automating a task I could manually perform, the time and effort were worth it for the enjoyment and knowledge gained.
The bot's functionality is divided into several key segments: Web scraping, SEC EDGAR API, GPT API, a Discord bot, and a web UI. Together, these components automate the process of tracking a company's stock split outcomes. Below is a brief outline of each step:
Web scraping: Using the Python package Selenium, I extract the latest stock splits from various financial websites. The extracted HTML data is converted into a dataframe, which is then used to query the SEC EDGAR API.
SEC EDGAR API: The SEC provides an API to access filings for all publicly listed companies in the U.S. Using the ticker from the web scraper, we identify the company's Central Index Key (CIK) and retrieve all relevant SEC filing documents. Keywords are used to filter for documents related specifically to stock splits.
GPT API: The filtered documents from the SEC EDGAR API are cleaned and uploaded to OpenAI's API. We instruct the LLM to determine the outcomes of the stock splits based on the provided documents.
Web UI: We built a web interface for managing upcoming and previous stock splits and posting announcements to our Discord channel. The UI features a home, analytics, and settings page.
Discord Bot: Using Discord's official API, we set up a bot that notifies us in a Discord channel about the outcomes of upcoming stock splits. This information helps inform our investment decisions.
Analytics: The Web UI features an analytics page is used to give us a simplified historical view of past reverse splits as well as the historical accuracy of our LLM model.
Docker: The scripts are all hosted in a docker container.
Tools/Frameworks I used: Python (Flask, Sellenium, Pandas), Javascript, HTML, CSS, MongoDB