Cheat Sheet
Common EdgarTools operations at a glance. For a step-by-step introduction, see the Quick Start.
Setup
|
Code |
| Set your EDGAR identity in Linux/Mac |
export EDGAR_IDENTITY="email@domain.com" |
| Set your EDGAR identity in Windows |
set EDGAR_IDENTITY="email@domain.com" |
| Set identity in Windows Powershell |
$env:EDGAR_IDENTITY="email@domain.com" |
| Set identity in Python |
set_identity("email@domain.com") |
| Importing the library |
from edgar import * |
Working with a company ๐ข
See also: Find a Company
|
Code |
| ๐ Get a company by ticker |
company = Company("AAPL") |
| ๐ Get a company by CIK |
company = Company("0000320193") |
| ๐ Find filings by form and ticker |
find(form="10-K", ticker="AAPL") |
| ๐ Get shares outstanding |
company.shares_outstanding |
| ๐ฐ Get public float |
company.public_float |
| ๐ญ Get industry |
company.industry |
| ๐ Get company facts |
company.get_facts() |
| ๐ผ Get company facts as a DataFrame |
company.get_facts().to_pandas() |
Financial statements ๐ต
See also: Financial Statements Guide
|
Code |
| ๐ Get a company's financials |
financials = company.get_financials() |
| ๐ Get the income statement |
financials.income_statement() |
| ๐ฆ Get the balance sheet |
financials.balance_sheet() |
| ๐ธ Get the cash flow statement |
financials.cashflow_statement() |
| ๐ฐ Get revenue |
financials.get_revenue() |
| ๐ต Get net income |
financials.get_net_income() |
| ๐ Get operating income |
financials.get_operating_income() |
| ๐ผ Export statement to DataFrame |
financials.income_statement().to_dataframe() |
Working with filings ๐
See also: Working with Filings ยท Search & Filter
๐ Getting Filings
|
Code |
| ๐
Get filings for the year to date |
filings = get_filings() |
| ๐ Get only XBRL filings |
filings = get_filings(index="xbrl") |
| ๐ Get filings for a specific year |
filings = get_filings(2020) |
| ๐๏ธ Get filings for a specific quarter |
filings = get_filings(2020, 1) |
| ๐ Get filings for multiple years |
filings = get_filings([2020, 2021]) |
| ๐ Get filings for a range of years |
filings = get_filings(year=range(2010, 2020)) |
| ๐ Get filings released just now |
filings = get_latest_filings() |
๐ Filtering Filings
|
Code |
| ๐ Filter by form type |
filings.filter(form="10-K") |
| ๐ Filter by multiple forms |
filings.filter(form=["10-K", "10-Q"]) |
| ๐ Include form amendments |
filings.filter(form="10-K", amendments=True) |
| ๐ข Filter by CIK |
filings.filter(cik="0000320193") |
| ๐๏ธ Filter by multiple CIKs |
filings.filter(cik=["0000320193", "1018724"]) |
| ๐ท๏ธ Filter by ticker |
filings.filter(ticker="AAPL") |
| ๐ท๏ธ๐ท๏ธ Filter by multiple tickers |
filings.filter(ticker=["AAPL", "MSFT"]) |
| ๐
Filter on a specific date |
filings.filter(date="2020-01-01") |
| ๐
โ๏ธ๐
Filter between dates |
filings.filter(date="2020-01-01:2020-03-01") |
| ๐
โฌ
๏ธ Filter before a date |
filings.filter(date=":2020-03-01") |
| ๐
โก๏ธ Filter after a date |
filings.filter(date="2020-03-01:") |
| ๐ Combine multiple filters |
filings.filter(form="10-K", date="2020-01-01:", ticker="AAPL") |
๐ Viewing and Manipulating Filings
|
Code |
| โญ๏ธ Show the next page of filings |
filings.next() |
| โฎ๏ธ Show the previous page of filings |
filings.previous() |
| ๐ Get the first n filings |
filings.head(20) |
| ๐ Get the last n filings |
filings.tail(20) |
| ๐ Get the latest n filings by date |
filings.latest(20) |
| ๐ฒ Get a random sample of filings |
filings.sample(20) |
| ๐ผ Get filings as a pandas DataFrame |
filings.to_pandas() |
Company filings ๐
See also: Find a Company
|
Code |
| ๐ Get company filings |
company.get_filings() |
| ๐ Get company filings by form |
company.get_filings(form="10-K") |
| ๐ Get the latest 10-Q |
company.latest("10-Q") |
| ๐ Get the last 5 10-Qs |
company.get_filings(form="10-Q").head(5) |
| ๐ข Get a filing by accession number |
company.get_filing(accession_number="0000320193-21-000139") |
Working with a filing ๐
See also: Working with Filings
๐ Accessing and Viewing a Filing
|
Code |
| ๐ Get a single filing |
filing = filings[3] |
| ๐ข Get a filing by accession number |
filing = get_by_accession_number("0000320193-20-34576") |
| ๐ Get the filing homepage |
filing.homepage |
| ๐ Open a filing in the browser |
filing.open() |
| ๐ Open homepage in the browser |
filing.homepage.open() |
| ๐ป View the filing in the terminal |
filing.view() |
|
Code |
| ๐ Get the HTML of the filing |
filing.html() |
| ๐ Get the XBRL of the filing |
filing.xbrl() |
| ๐ Get the filing as markdown |
filing.markdown() |
| ๐ Get the full submission text |
filing.full_text_submission() |
| ๐ Preview data object type |
filing.obj_type |
| ๐ข Get and parse filing data object |
filing.obj() |
| ๐ Get filing header |
filing.header |
๐ Searching Inside a Filing
|
Code |
| ๐ Search within the filing |
filing.search("query") |
| ๐ Search with regex |
filing.search("pattern", regex=True) |
| ๐ Get filing sections |
filing.sections() |
๐ Working with Attachments
See also: Filing Attachments
|
Code |
| ๐ Get all filing attachments |
filing.attachments |
| ๐ Get a single attachment |
attachment = filing.attachments[0] |
| ๐ Open attachment in browser |
attachment.open() |
| โฌ๏ธ Download an attachment |
content = attachment.download() |
10-K Annual Report data ๐
See also: Working with Filings
|
Code |
| ๐ Get 10-K as data object |
tenk = company.get_filings(form="10-K").latest().obj() |
| ๐ข Get auditor information |
tenk.auditor |
| ๐ข Get auditor name |
tenk.auditor.name |
| ๐ข Get PCAOB firm ID |
tenk.auditor.firm_id |
| ๐๏ธ Get subsidiaries |
tenk.subsidiaries |
| ๐ผ Subsidiaries as DataFrame |
tenk.subsidiaries.to_dataframe() |
Proxy statements (executive compensation) ๐ผ
See also: Proxy Statements Guide
|
Code |
| ๐ Get latest proxy statement |
proxy = company.get_filings(form="DEF 14A").latest().obj() |
| ๐ค Get CEO name |
proxy.peo_name |
| ๐ฐ Get CEO total compensation |
proxy.peo_total_comp |
| ๐ Get 5-year exec compensation DataFrame |
proxy.executive_compensation |
| ๐ Get pay vs performance DataFrame |
proxy.pay_vs_performance |
| ๐ Get company TSR |
proxy.total_shareholder_return |
| ๐ Get peer group TSR |
proxy.peer_group_tsr |
Prefer a visual interface?
Every operation above also works through edgar.tools โ the same SEC data in a web UI, no code required.
Also includes a REST API (20+ endpoints), hosted MCP server, and data exports. Free tier: 100 API calls/day.