providing insights into mutual fund investments and company financials
- Which mutual funds are we tracking
- Find their official ID number (CIK)
- Use that ID to pull their holdings from the SEC
- Analyze those reports to see what stocks/bonds they hold
- Build insights
To pull the CIKs of the MF_O mutual funds (no duplicates (4842 entries)), 3628 entity ciks were found. This is using the web scraping tecnique. It took 27 mins and 22 secs. Now to pull the ciks with the series ciks, it took 34 mins and 25 secs. Still 3628 entity ciks found.
The name, CIK, and Series CIK for each notable mutual fund (MF_O) are stored in a CSV file. For now, the 1214 names without a corresponding CIK will be ignored. Having the CIK is crucial for programmatically accessing data from the SEC.
Mutual funds report their holdings and portfolio information, along with a slew of other data required by the SEC, in a submission. The entire list of submissions of a mutual fund can be viewed using the SEC API. For financial/portfolio information, the NPORT-P filing is of most interest. Presented in either xml or html, identifying and selecting the files is straighforward. Then, using BeautifulSoup, the entire NPORT file is parsed and prepared to be fed to the LLM.
GPT is plenty capable of providing profound insights for financial information, so OpenAI API model GPT-4o-mini is used to provide the insights of a file. A properly engineered prompt and low temperature (0.1-0.2) mean that formatting can be relatively consistent throughout multiple analyses.
Currently the model only reads one file (from a hardcoded CIK) and prints output. Next steps include:
+ Pulling the CIKs for multiple mutual funds from the CSV file (array for speed and ease)
+ Saving the output/insights to a file
+ Using multiple filings from a company over time to generate trends (this would require adding context to the AI)
+ Using the insights from multiple mutual funds to detect industry/sector/era trends
+ Incorporate macro data from other federal sources and media to complement insights