edgartools: SEC EDGAR Filings Analysis
EdgarTools is a Python library designed to access and analyze SEC EDGAR filings, XBRL financial statements, 10-K, 10-Q, and 8-K reports. It provides structured Python objects for over 20 filing types, converting complex SEC data into easy-to-use DataFrames. Currently at version 5.29.0, the library is actively developed with frequent updates addressing bug fixes and adding new features, often multiple releases per month.
Warnings
- gotcha The SEC requires all API users to identify themselves with a name and email. Failing to do so will result in an error when making requests.
- gotcha There is an unrelated package on PyPI also named `edgar`. Installing `edgar` instead of `edgartools` will lead to `ImportError`.
- gotcha Prior to v5.28.5, the `to_dataframe()` method for disclosure `TextBlock` concepts could contain raw HTML markup instead of plain text, leading to uncleaned data in DataFrames.
- gotcha Before v5.28.3, financial statement quarter labels for companies with non-calendar fiscal years might have been incorrect, using hardcoded calendar months instead of the company's fiscal year end month.
- gotcha The SEC imposes rate limits (typically 10 requests per second) on EDGAR data access. Exceeding these limits can result in your IP being temporarily blocked.
- deprecated While `cash_flow_statement()` still works, the canonical method for retrieving cash flow statements is `cashflow_statement()` (without an underscore).
Install
-
pip install edgartools
Imports
- Company
from edgar import Company
- set_identity
from edgar import set_identity
- get_filings
from edgar import get_filings
Quickstart
import os
from edgar import Company, set_identity
# The SEC requires all API users to identify themselves with a name and email.
# Set this once or use the EDGAR_IDENTITY environment variable.
identity = os.environ.get('EDGAR_IDENTITY', 'John Doe john.doe@example.com')
set_identity(identity)
# Get a company by its ticker symbol
company = Company("AAPL")
# Access basic company data
print(f"Company: {company.name}")
print(f"Industry: {company.industry}")
# Get the company's latest financial statements
financials = company.get_financials()
income_statement = financials.income_statement()
balance_sheet = financials.balance_sheet()
cashflow_statement = financials.cashflow_statement()
print("\nLatest Income Statement (first 5 rows):\n", income_statement.head())
print("\nLatest Balance Sheet (first 5 rows):\n", balance_sheet.head())