SEC EDGAR Downloader

5.1.0 · active · verified Thu Apr 16

sec-edgar-downloader is a Python package designed for efficiently downloading company filings from the SEC EDGAR database. Currently at version 5.1.0, it underwent a full rewrite in 5.0.0 to leverage the SEC's official EDGAR API and integrates formal rate-limiting using `pyrate-limiter` to comply with SEC fair access policies (10 requests per second). The library actively maintains support for recent Python versions and has a consistent release cadence with new features and fixes.

Common errors

Warnings

Install

Imports

Quickstart

Initialize the `Downloader` with a valid company name and email address as your `User-Agent` (critical for SEC compliance) and then use the `get()` method to download filings by form type and ticker/CIK. The example demonstrates downloading a single 10-K filing and multiple 8-K filings after a certain date.

import os
from sec_edgar_downloader import Downloader

# It's crucial to set a User-Agent to comply with SEC's fair access policy.
# Replace with your company name and admin contact email.
# Example: 'MyCompanyName AdminContact@mycompany.com'
company_name = os.environ.get('SEC_EDGAR_COMPANY_NAME', 'My Test Company')
email_address = os.environ.get('SEC_EDGAR_EMAIL', 'test@example.com')

# Initialize a downloader instance. Filings will be saved to the current working directory by default.
# You can specify a different download_folder: dl = Downloader(company_name, email_address, '~/sec_filings')
dl = Downloader(company_name, email_address)

try:
    # Download the latest 10-K filing for Apple (AAPL)
    # The 'limit' parameter controls the number of most recent filings to download.
    count = dl.get('10-K', 'AAPL', limit=1)
    print(f"Successfully downloaded {count} filing(s) for AAPL.")

    # Download all 8-K filings for Microsoft (MSFT) after a specific date
    count = dl.get('8-K', 'MSFT', after='2023-01-01')
    print(f"Successfully downloaded {count} 8-K filing(s) for MSFT after 2023-01-01.")
except Exception as e:
    print(f"An error occurred: {e}")
    print("Ensure your User-Agent is properly set and you are not exceeding SEC rate limits.")

view raw JSON →