Documentation Index
Fetch the complete documentation index at: https://docs.secapi.ai/llms.txt
Use this file to discover all available pages before exploring further.
Build a 13F Holdings Tracker Agent
Institutional investors managing over $100 million in qualifying securities must file Form 13F with the SEC each quarter. This tutorial builds a Python agent that pulls 13F holdings for any fund manager, compares them across quarters, and generates a detailed markdown report showing new positions, closed positions, and size changes.What you will build
- A Python script that fetches 13F holdings from the OMNI Datastream API
- Quarter-over-quarter comparison logic for detecting position changes
- A markdown report generator with tables for new, closed, and changed positions
- Support for tracking multiple fund managers at once
Prerequisites
- An Omni Datastream API key (set as
OMNI_DATASTREAM_API_KEY) - Python 3.9+
- Basic familiarity with the SEC 13F filing system
Step 1 — Set up the project
Create a project directory and install dependencies.requirements.txt:
.env file for your API key:
Step 2 — Build the API client
Createtracker.py with the core API interaction layer.
Step 3 — Build the comparison engine
Add functions to compare holdings between two quarters and classify the changes.Step 4 — Generate the markdown report
Add a report generator that produces a clean markdown document.Step 5 — Wire up the main function
Add the entry point that ties everything together.Step 6 — Run the tracker
Execute the script to generate reports for all configured fund managers.Expected output
Step 7 — Automate with cron
Set up a quarterly schedule to run the tracker after 13F filing deadlines (45 days after quarter end).Next steps
- Compare specific holders of a stock: Use the
/v1/owners/13fendpoint with a ticker parameter to see which institutions hold a specific stock and how their positions changed. - Add portfolio-level analytics: Use the
/v1/portfolio/analyzeendpoint to calculate sector concentration and risk metrics for a fund’s 13F holdings. - Track 13D/13G activist positions: Extend the tracker to also monitor
/v1/owners/13d-13gfor activist investor disclosures. - Build a historical database: Store quarterly snapshots in SQLite or PostgreSQL to analyze long-term trends in institutional positioning.