I developed a comprehensive Python script that automates the process of fetching SEC filing data from an API, saving the information, and downloading associated PDF documents. This tool is designed for financial analysts, researchers, or any professionals needing historical SEC filings data for analysis or compliance.
Project Details:
API Integration and Data Fetching:
- I integrated with the SEC’s API (https://api.sec-api.io/filing-reader) to fetch financial filings data.
- The script mimics browser request headers using Python’s Requests library to avoid being blocked by the API while fetching detailed data.
- It allows users to generate an API key and input search parameters such as Ticker Symbol, CIK, Filing Type, and date ranges.
GUI and User Input:
- I built a user-friendly GUI using Selenium WebDriver, where users can input the desired parameters.
- The GUI also displays the fetched data, logs the process, and provides options to export data in CSV or HTML formats.
PDF Downloading:
- If the API returns a filing PDF, the script automatically downloads all related PDFs, organizing them by company or filing date.
- The script intelligently checks for duplicate PDFs, ensuring no file is downloaded more than once.
- PDFs are saved in user-specified folders, with filenames that make it easy to track each document.
Data Fields Scraped:
- Filed At, Filing Type, CIK, Ticker, Company Name, Filing URL, TXT Version of Filing, Index Page URL.
How I Achieved It:
- I used Python’s Requests library to communicate with the API endpoint and Selenium to build the GUI for easy user interaction.
- The script handles API requests by mimicking browser headers, ensuring smooth access to data and avoiding common request blocks.
- I designed the PDF downloading functionality to recursively access filing URLs, download all PDF versions of filings, and organize them into folders based on user preferences.
- The tool includes advanced file handling to prevent duplicate downloads, ensuring clean and well-organized data output.
This project enabled my client to automate SEC filing retrieval, saving significant time and effort while ensuring accurate and organized data collection.
Screenshots:
If you need API integration, data fetching, or document downloading solutions, I can build a tailored system for your business requirements. Don’t hesitate to Contact Me to discuss your project.