Chapter 44
EdgarTools: Interactive SEC Filing Analysis
EdgarTools: Interactive SEC Filing Analysis
Chapter 4: Fundamental and Alternative Data
Docker image: ml4t
Section Reference: Section 4.1 (The EDGAR Sourcing Pipeline)
Purpose
This notebook demonstrates EdgarTools, a high-level Python library for interactive SEC EDGAR analysis. EdgarTools excels at company exploration, financial statement extraction, and working with structured filing data like Form 4 and 13F.
Learning Objectives
After completing this notebook, you will be able to:
- Look up companies by ticker, CIK, or search
- Retrieve and filter SEC filings
- Extract XBRL-parsed financial statements (income, balance sheet, cash flow)
- Analyze Form 4 insider transactions
- Examine 13F institutional holdings
Cross-References
- Related:
03_sec_form4_insider_transactions(Form 4 XML parsing) - Downstream:
04_sec_xbrl_fundamentals(cross-sectional XBRL via API)
When to Use EdgarTools
| Use Case | EdgarTools Fit |
|---|---|
| Single company exploration | Excellent |
| Financial statement extraction | Excellent |
| Form 4/13F structured data | Excellent |
| Bulk downloads (1000s of filings) | Use sec-edgar instead |
| Cross-sectional fundamentals | Use XBRL Frames API |
WARNING: Point-in-Time (PIT) Note
This notebook demonstrates data exploration, not PIT-correct data pipelines. For backtesting or ML training, always use the filing_date (when data became public), not the period_end (accounting date). Filing dates are typically 30-90 days after period end.
"""EdgarTools: Interactive SEC Filing Analysis — explore SEC filings, financial statements, and insider transactions."""
import os
import warnings
warnings.filterwarnings("ignore")
import plotly.graph_objects as go
import polars as pl# Production defaults — Papermill injects overrides for CIfrom edgar import Company, find, get_filings, set_identity
# Importing utils.style registers and activates the ML4T Plotly template
# (house palette, fonts, gridlines) so figures inherit the book style.
from utils.style import COLORS
# SEC requires a real User-Agent (name + email) for every request and blocks
# placeholder addresses. Set `EDGAR_IDENTITY` in your environment, e.g.
# `export EDGAR_IDENTITY="Jane Doe jane@example.org"`.
edgar_identity = os.environ.get("EDGAR_IDENTITY")
if not edgar_identity:
raise RuntimeError(
"EDGAR_IDENTITY environment variable is not set. The SEC requires a "
"real User-Agent (name + email) for every EDGAR request and blocks "
"placeholder addresses. Set it before running this notebook, e.g. "
'`export EDGAR_IDENTITY="Jane Doe jane@example.org"`.'
)
set_identity(edgar_identity)
print("EdgarTools loaded.")Output
EdgarTools loaded.
Part 1: Company Lookup
EdgarTools provides multiple ways to find companies:
- By ticker symbol (most common)
- By CIK (SEC's Central Index Key)
- By search query
# Look up by ticker
apple = Company("AAPL")
print(f"=== {apple.name} ===")
print(f"CIK: {apple.cik}")
print(f"Tickers: {apple.tickers}")
print(f"SIC Code: {apple.sic}")Output
=== Apple Inc. === CIK: 320193 Tickers: ['AAPL'] SIC Code: 3571
# Look up by CIK (with or without zero-padding)
tesla_by_cik = Company("1318605")
print(f"Tesla by CIK: {tesla_by_cik.name}")
# Zero-padded also works
tesla_padded = Company("0001318605")
print(f"Tesla padded: {tesla_padded.name}")Output
Tesla by CIK: Tesla, Inc.
Tesla padded: Tesla, Inc.
# Search for companies by name
results = find("Microsoft")
resultsOutput
[3m Search results for 'Microsoft' [0m
[1m [0m[1m [0m[1m [0m [1m [0m[1mTicker[0m[1m [0m [1m [0m[1mName [0m[1m [0m [1m [0m[1mScore[0m[1m [0m
─────────────────────────────────────
0 MSFT MICROSOFT CORP 100%
Part 2: Retrieving Filings
The get_filings() method returns a filterable collection of filings.
Filter by form type, date range, or both.
# Get all filings for Apple
all_filings = apple.get_filings()
print(f"Total Apple filings: {len(all_filings)}")Output
Total Apple filings: 2236
# Filter by form type
annual_reports = apple.get_filings(form="10-K")
quarterly_reports = apple.get_filings(form="10-Q")
eightks = apple.get_filings(form="8-K")
print(f"10-K filings: {len(annual_reports)}")
print(f"10-Q filings: {len(quarterly_reports)}")
print(f"8-K filings: {len(eightks)}")Output
10-K filings: 32 10-Q filings: 99 8-K filings: 234
# Get the latest filing
latest_10k = annual_reports.latest()
print("=== Latest 10-K ===")
print(f"Filing Date: {latest_10k.filing_date}")
print(f"Accession Number: {latest_10k.accession_no}")
print(f"Is XBRL: {latest_10k.is_xbrl}")Output
=== Latest 10-K === Filing Date: 2025-10-31 Accession Number: 0000320193-25-000079 Is XBRL: 1
# Multiple form types at once
insider_forms = apple.get_filings(form=["3", "4", "5"])
print(f"Insider filings (Forms 3, 4, 5): {len(insider_forms)}")Output
Insider filings (Forms 3, 4, 5): 1381
Part 3: Financial Statements from XBRL
EdgarTools parses XBRL data to provide direct access to financial statements. This is the key differentiator from other SEC libraries.
# Get financials from the company (uses latest 10-K)
financials = apple.get_financials()
financialsOutput
[38;5;244m╭─[0m[38;5;244m───────────────────────────────────[0m[38;5;244m [0m[1;38;5;244m10-K [0m[1;32mApple Inc.[0m[38;5;244m [0m[1;38;5;220m(AAPL)[0m[2;38;5;244m • CIK [0m[2;38;5;244m0000[0m[1;38;5;244m320193[0m[38;5;244m [0m[38;5;244m───────────────────────────────────[0m[38;5;244m─╮[0m [38;5;244m│[0m [38;5;249m [0m[38;5;249mFiscal Period [0m[38;5;249m [0m[1m [0m[1mFiscal Year 2025 (ended Sep 27, 2025)[0m[1m [0m [38;5;244m│[0m [38;5;244m│[0m [38;5;249m [0m[38;5;249mData [0m[38;5;249m [0m[1m [0m[1m1,131 facts • 182 contexts [0m[1m [0m [38;5;244m│[0m [38;5;244m│[0m [38;5;244m│[0m [38;5;244m│[0m [1mPeriods[0m [38;5;244m│[0m [38;5;244m│[0m [38;5;249m [0m[38;5;249mAnnual [0m[38;5;249m [0m FY 2025, FY 2024, FY 2023 [38;5;244m│[0m [38;5;244m│[0m [2;3m (1 future period after 2025-09-27 excluded)[0m [38;5;244m│[0m [38;5;244m│[0m [38;5;244m│[0m [38;5;244m│[0m [1mStatements (72)[0m [38;5;244m│[0m [38;5;244m│[0m [38;5;249m [0m[38;5;249mStatements [0m[38;5;249m [0m[2m [0m[2mIncome, Compr. Income, Balance Sheet, Equity, Cash Flow [0m [38;5;244m│[0m [38;5;244m│[0m [38;5;249m [0m[38;5;249mNotes [0m[38;5;249m [0m[2m [0m[2mInsider Trading Arrangements, Insider Trading Policies Proc, 9952165 - Disclosure - Debt, 9[0m [38;5;244m│[0m [38;5;244m│[0m [38;5;249m [0m[38;5;249mDisclosures [0m[38;5;249m [0m[2m [0m[2mPvp Disclosure, Err Comp Disclosure, Award Timing Disclosure, 9955546 - Disclosure - Debt -[0m [38;5;244m│[0m [38;5;244m│[0m [38;5;249m [0m[38;5;249mDocument [0m[38;5;249m [0m[2m [0m[2m0000001 - Document - Cover Page, 0000002 - Document - Audit or Information [0m [38;5;244m│[0m [38;5;244m╰─[0m[38;5;244m────────────────────────────────────────────────────────────────────────[0m[38;5;244m [0m[2;38;5;244mXBRL Data[0m[38;5;244m • [0m[2;3;38;5;244mxbrl.statements[0m[2;38;5;244m to browse[0m[38;5;244m [0m[38;5;244m─╯[0m
3.1 Income Statement
# Get income statement
income = financials.income_statement()
incomeOutput
[38;5;244m [0m [38;5;244m [0m [1;32mAPPLE INC. [0m[1;30;42m AAPL [0m [38;5;244m [0m [38;5;244m [0m [1mCONSOLIDATED STATEMENT OF INCOME[0m [38;5;244m [0m [38;5;244m [0m [2mSep 30, 2023 to Sep 27, 2025[0m [38;5;244m [0m [38;5;244m [0m [38;5;244m [0m [38;5;244m [0m [1m [0m[1m [0m[1m [0m [1m [0m[1mSep 27, 2025[0m[1m [0m [1m [0m[1mSep 28, 2024[0m[1m [0m [1m [0m[1mSep 30, 2023[0m[1m [0m [38;5;244m [0m [38;5;244m [0m ─────────────────────────────────────────────────────────────────────────────────────────────── [38;5;244m [0m [38;5;244m [0m [1m Net sales: [0m [1m [0m[1m $416,161[0m[1m [0m [1m [0m[1m $391,035[0m[1m [0m [1m [0m[1m $383,285[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [2m Products [0m [1m [0m[1m $307,003[0m[1m [0m [1m [0m[1m $294,866[0m[1m [0m [1m [0m[1m $298,085[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [2m Services [0m [1m [0m[1m $109,158[0m[1m [0m [1m [0m[1m $96,169[0m[1m [0m [1m [0m[1m $85,200[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Cost of sales: [0m [1m [0m[1m $220,960[0m[1m [0m [1m [0m[1m $210,352[0m[1m [0m [1m [0m[1m $214,137[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [2m Products [0m [1m [0m[1m $194,116[0m[1m [0m [1m [0m[1m $185,233[0m[1m [0m [1m [0m[1m $189,282[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [2m Services [0m [1m [0m[1m $26,844[0m[1m [0m [1m [0m[1m $25,119[0m[1m [0m [1m [0m[1m $24,855[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Gross margin [1m [0m[1m $195,201[0m[1m [0m [1m [0m[1m $180,683[0m[1m [0m [1m [0m[1m $169,148[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1;2m Operating expenses: [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Research and development: [0m [1m [0m[1m $34,550[0m[1m [0m [1m [0m[1m $31,370[0m[1m [0m [1m [0m[1m $29,915[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Selling, general and administrative [1m [0m[1m $27,601[0m[1m [0m [1m [0m[1m $26,097[0m[1m [0m [1m [0m[1m $24,932[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Total operating expenses [0m [1m [0m[1m $62,151[0m[1m [0m [1m [0m[1m $57,467[0m[1m [0m [1m [0m[1m $54,847[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Operating income: [0m [1m [0m[1m $133,050[0m[1m [0m [1m [0m[1m $123,216[0m[1m [0m [1m [0m[1m $114,301[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Other income/(expense), net [1m [0m[1;31m $(321)[0m[1m [0m [1m [0m[1m $269[0m[1m [0m [1m [0m[1;31m $(565)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Income before provision for income taxes [1m [0m[1m $132,729[0m[1m [0m [1m [0m[1m $123,485[0m[1m [0m [1m [0m[1m $113,736[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Provision for income taxes [1m [0m[1m $20,719[0m[1m [0m [1m [0m[1m $29,749[0m[1m [0m [1m [0m[1m $16,741[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Net income: [0m [1m [0m[1m $112,010[0m[1m [0m [1m [0m[1m $93,736[0m[1m [0m [1m [0m[1m $96,995[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1;2m Earnings per share: [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m Basic (in dollars per share) [1m [0m[1m 7.49[0m[1m [0m [1m [0m[1m 6.11[0m[1m [0m [1m [0m[1m 6.16[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Diluted (in dollars per share) [1m [0m[1m 7.46[0m[1m [0m [1m [0m[1m 6.08[0m[1m [0m [1m [0m[1m 6.13[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1;2m Shares used in computing earnings per share:[0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m Basic (in shares) [1m [0m[1m 14,948,500[0m[1m [0m [1m [0m[1m 15,343,783[0m[1m [0m [1m [0m[1m 15,744,231[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Diluted (in shares) [1m [0m[1m 15,004,697[0m[1m [0m [1m [0m[1m 15,408,095[0m[1m [0m [1m [0m[1m 15,812,547[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [38;5;244m [0m [38;5;244m [0m[38;5;244m [0m[2;3;38;5;244mSource: [0m[38;5;220mSEC XBRL[0m[38;5;244m [0m[38;5;244m•[0m[38;5;244m [0m[2;38;5;244m(In millions, except shares in thousands and per share data)[0m[38;5;244m [0m[38;5;244m [0m[38;5;244m [0m
# Convert to DataFrame for analysis (wide format: one column per period)
income_df = income.to_dataframe()
date_cols = [c for c in income_df.columns if c[0].isdigit()]
print(f"Shape: {income_df.shape}")
print(f"Period columns: {date_cols}")
income_df[["label", *date_cols]].head(15)Output
Shape: (47, 19) Period columns: ['2025-09-27 (FY)', '2024-09-28 (FY)', '2023-09-30 (FY)']
label 2025-09-27 (FY) \
0 Net sales 4.161610e+11
1 Products 3.070030e+11
2 iPhone 2.095860e+11
3 Mac 3.370800e+10
4 iPad 2.802300e+10
5 Wearables, Home and Accessories 3.568600e+10
6 Services 1.091580e+11
7 Operating segments - Americas 1.783530e+11
8 Operating segments - Europe 1.110320e+11
9 Operating segments - Greater China 6.437700e+10
10 Operating segments - Japan 2.870300e+10
11 Operating segments - Rest of Asia Pacific 3.369600e+10
12 U.S. 1.517900e+11
13 China 6.437700e+10
14 Other countries 1.999940e+11
2024-09-28 (FY) 2023-09-30 (FY)
0 3.910350e+11 3.832850e+11
1 2.948660e+11 2.980850e+11
2 2.011830e+11 2.005830e+11
3 2.998400e+10 2.935700e+10
4 2.669400e+10 2.830000e+10
5 3.700500e+10 3.984500e+10
6 9.616900e+10 8.520000e+10
7 1.670450e+11 1.625600e+11
8 1.013280e+11 9.429400e+10
9 6.695200e+10 7.255900e+10
10 2.505200e+10 2.425700e+10
11 3.065800e+10 2.961500e+10
12 1.421960e+11 1.385730e+11
13 6.695200e+10 7.255900e+10
14 1.818870e+11 1.721530e+11 | label | 2025-09-27 (FY) | 2024-09-28 (FY) | 2023-09-30 (FY) | |
|---|---|---|---|---|
| 0 | Net sales | 4.161610e+11 | 3.910350e+11 | 3.832850e+11 |
| 1 | Products | 3.070030e+11 | 2.948660e+11 | 2.980850e+11 |
| 2 | iPhone | 2.095860e+11 | 2.011830e+11 | 2.005830e+11 |
| 3 | Mac | 3.370800e+10 | 2.998400e+10 | 2.935700e+10 |
| 4 | iPad | 2.802300e+10 | 2.669400e+10 | 2.830000e+10 |
| 5 | Wearables, Home and Accessories | 3.568600e+10 | 3.700500e+10 | 3.984500e+10 |
| 6 | Services | 1.091580e+11 | 9.616900e+10 | 8.520000e+10 |
| 7 | Operating segments - Americas | 1.783530e+11 | 1.670450e+11 | 1.625600e+11 |
| 8 | Operating segments - Europe | 1.110320e+11 | 1.013280e+11 | 9.429400e+10 |
| 9 | Operating segments - Greater China | 6.437700e+10 | 6.695200e+10 | 7.255900e+10 |
| 10 | Operating segments - Japan | 2.870300e+10 | 2.505200e+10 | 2.425700e+10 |
| 11 | Operating segments - Rest of Asia Pacific | 3.369600e+10 | 3.065800e+10 | 2.961500e+10 |
| 12 | U.S. | 1.517900e+11 | 1.421960e+11 | 1.385730e+11 |
| 13 | China | 6.437700e+10 | 6.695200e+10 | 7.255900e+10 |
| 14 | Other countries | 1.999940e+11 | 1.818870e+11 | 1.721530e+11 |
3.2 Balance Sheet
# Get balance sheet
balance = financials.balance_sheet()
balanceOutput
[38;5;244m [0m [38;5;244m [0m [1;32mAPPLE INC. [0m[1;30;42m AAPL [0m [38;5;244m [0m [38;5;244m [0m [1mCONSOLIDATED BALANCE SHEETS[0m [38;5;244m [0m [38;5;244m [0m [2mSep 28, 2024 to Sep 27, 2025[0m [38;5;244m [0m [38;5;244m [0m [38;5;244m [0m [38;5;244m [0m [1m [0m[1m [0m[1m [0m [1m [0m[1mSep 27, 2025[0m[1m [0m [1m [0m[1mSep 28, 2024[0m[1m [0m [38;5;244m [0m [38;5;244m [0m ───────────────────────────────────────────────────────────────────────────────────────────────────────────── [38;5;244m [0m [38;5;244m [0m [1mASSETS: [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1;2m Current assets: [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Cash and cash equivalents: [0m [1m [0m[1m $35,934[0m[1m [0m [1m [0m[1m $29,943[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Marketable securities: [0m [1m [0m[1m $18,763[0m[1m [0m [1m [0m[1m $35,228[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Accounts receivable, net [1m [0m[1m $39,777[0m[1m [0m [1m [0m[1m $33,410[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Vendor non-trade receivables [1m [0m[1m $33,180[0m[1m [0m [1m [0m[1m $32,833[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Inventories [1m [0m[1m $5,718[0m[1m [0m [1m [0m[1m $7,286[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Other current assets [1m [0m[1m $14,585[0m[1m [0m [1m [0m[1m $14,287[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Total current assets [0m [1m [0m[1m $147,957[0m[1m [0m [1m [0m[1m $152,987[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1;2m Non-current assets: [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Marketable securities: [0m [1m [0m[1m $77,723[0m[1m [0m [1m [0m[1m $91,479[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Property, plant and equipment, net [1m [0m[1m $49,834[0m[1m [0m [1m [0m[1m $45,680[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Other non-current assets [1m [0m[1m $83,727[0m[1m [0m [1m [0m[1m $74,834[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Total non-current assets [0m [1m [0m[1m $211,284[0m[1m [0m [1m [0m[1m $211,993[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Total assets [0m [1m [0m[1m $359,241[0m[1m [0m [1m [0m[1m $364,980[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1mLIABILITIES AND SHAREHOLDERS’ EQUITY: [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1;2m Current liabilities: [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m Accounts payable [1m [0m[1m $69,860[0m[1m [0m [1m [0m[1m $68,960[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Other current liabilities [1m [0m[1m $66,387[0m[1m [0m [1m [0m[1m $78,304[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Deferred revenue [1m [0m[1m $9,055[0m[1m [0m [1m [0m[1m $8,249[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Commercial paper: [0m [1m [0m[1m $7,979[0m[1m [0m [1m [0m[1m $9,967[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [2m Commercial paper [0m [1m [0m[1m $8,000[0m[1m [0m [1m [0m[1m $10,000[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Term debt [1m [0m[1m $12,350[0m[1m [0m [1m [0m[1m $10,912[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Total current liabilities [0m [1m [0m[1m $165,631[0m[1m [0m [1m [0m[1m $176,392[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1;2m Non-current liabilities: [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m Term debt [1m [0m[1m $78,328[0m[1m [0m [1m [0m[1m $85,750[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Other non-current liabilities [1m [0m[1m $41,549[0m[1m [0m [1m [0m[1m $45,888[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Total non-current liabilities [0m [1m [0m[1m $119,877[0m[1m [0m [1m [0m[1m $131,638[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Total liabilities [0m [1m [0m[1m $285,508[0m[1m [0m [1m [0m[1m $308,030[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Commitments and contingencies [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Common stock, shares outstanding (in shares): [0m [1m [0m[1m 14,773,260[0m[1m [0m [1m [0m[1m 15,116,786[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Common stock, shares issued (in shares) [1m [0m[1m 14,773,260[0m[1m [0m [1m [0m[1m 15,116,786[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1;2m Shareholders’ equity: [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m Common stock and additional paid-in capital, $0.00001 par value: [1m [0m[1m $93,568[0m[1m [0m [1m [0m[1m $83,276[0m[1m [0m [38;5;244m [0m [38;5;244m [0m 50,400,000 shares authorized; 14,773,260 and 15,116,786 shares issued and [1m [0m [1m [0m [38;5;244m [0m [38;5;244m [0m outstanding, respectively [1m [0m [1m [0m [38;5;244m [0m [38;5;244m [0m Accumulated deficit [1m [0m[1;31m $(14,264)[0m[1m [0m [1m [0m[1;31m $(19,154)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Accumulated other comprehensive loss [1m [0m[1;31m $(5,571)[0m[1m [0m [1m [0m[1;31m $(7,172)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Total shareholders’ equity: [0m [1m [0m[1m $73,733[0m[1m [0m [1m [0m[1m $56,950[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Total liabilities and shareholders’ equity [0m [1m [0m[1m $359,241[0m[1m [0m [1m [0m[1m $364,980[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [38;5;244m [0m [38;5;244m [0m[38;5;244m [0m[2;3;38;5;244mSource: [0m[38;5;220mSEC XBRL[0m[38;5;244m [0m[38;5;244m•[0m[38;5;244m [0m[2;38;5;244m(In millions, except shares in thousands and per share data)[0m[38;5;244m [0m[38;5;244m [0m[38;5;244m [0m
balance_df = balance.to_dataframe()
print(f"Balance sheet rows: {len(balance_df)}")Output
Balance sheet rows: 79
3.3 Cash Flow Statement
# Get cash flow statement
cashflow = financials.cashflow_statement()
cashflowOutput
[38;5;244m [0m [38;5;244m [0m [1;32mAPPLE INC. [0m[1;30;42m AAPL [0m [38;5;244m [0m [38;5;244m [0m [1mCONSOLIDATED STATEMENT OF CASH FLOWS[0m [38;5;244m [0m [38;5;244m [0m [2mSep 30, 2023 to Sep 27, 2025[0m [38;5;244m [0m [38;5;244m [0m [38;5;244m [0m [38;5;244m [0m [1m [0m[1m [0m[1m [0m [1m [0m[1mSep 27, 2025[0m[1m [0m [1m [0m[1mSep 28, 2024[0m[1m [0m [1m [0m[1mSep 30, 2023[0m[1m [0m [38;5;244m [0m [38;5;244m [0m ───────────────────────────────────────────────────────────────────────────────────────────────────────────── [38;5;244m [0m [38;5;244m [0m Cash, cash equivalents, and restricted cash and cash [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m equivalents, ending balances [1m [0m [1m [0m [1m [0m [38;5;244m [0m [38;5;244m [0m [1mOperating activities: [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Net income: [0m [1m [0m[1m $112,010[0m[1m [0m [1m [0m[1m $93,736[0m[1m [0m [1m [0m[1m $96,995[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1;2m Adjustments to reconcile net income to cash generated by [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1;2moperating activities: [0m [1m [0m [1m [0m [1m [0m [38;5;244m [0m [38;5;244m [0m Depreciation and amortization [1m [0m[1m $11,698[0m[1m [0m [1m [0m[1m $11,445[0m[1m [0m [1m [0m[1m $11,519[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Share-based compensation expense [1m [0m[1m $12,863[0m[1m [0m [1m [0m[1m $11,688[0m[1m [0m [1m [0m[1m $10,833[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Other [1m [0m[1;31m $(89)[0m[1m [0m [1m [0m[1;31m $(2,266)[0m[1m [0m [1m [0m[1;31m $(2,227)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1;2m Changes in operating assets and liabilities: [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m Accounts receivable, net [1m [0m[1;31m $(6,682)[0m[1m [0m [1m [0m[1;31m $(3,788)[0m[1m [0m [1m [0m[1;31m $(1,688)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Vendor non-trade receivables [1m [0m[1;31m $(347)[0m[1m [0m [1m [0m[1;31m $(1,356)[0m[1m [0m [1m [0m[1m $1,271[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Inventories [1m [0m[1m $1,400[0m[1m [0m [1m [0m[1;31m $(1,046)[0m[1m [0m [1m [0m[1;31m $(1,618)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Other current and non-current assets [1m [0m[1;31m $(9,197)[0m[1m [0m [1m [0m[1;31m $(11,731)[0m[1m [0m [1m [0m[1;31m $(5,684)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Accounts payable [1m [0m[1m $902[0m[1m [0m [1m [0m[1m $6,020[0m[1m [0m [1m [0m[1;31m $(1,889)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Other current and non-current liabilities [1m [0m[1;31m $(11,076)[0m[1m [0m [1m [0m[1m $15,552[0m[1m [0m [1m [0m[1m $3,031[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Cash generated by operating activities [1m [0m[1m $111,482[0m[1m [0m [1m [0m[1m $118,254[0m[1m [0m [1m [0m[1m $110,543[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1mInvesting activities: [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m Purchases of marketable securities [1m [0m[1;31m $(24,407)[0m[1m [0m [1m [0m[1;31m $(48,656)[0m[1m [0m [1m [0m[1;31m $(29,513)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Proceeds from maturities of marketable securities [1m [0m[1m $40,907[0m[1m [0m [1m [0m[1m $51,211[0m[1m [0m [1m [0m[1m $39,686[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Proceeds from sales of marketable securities [1m [0m[1m $12,890[0m[1m [0m [1m [0m[1m $11,135[0m[1m [0m [1m [0m[1m $5,828[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Payments for acquisition of property, plant and [1m [0m[1;31m $(12,715)[0m[1m [0m [1m [0m[1;31m $(9,447)[0m[1m [0m [1m [0m[1;31m $(10,959)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m equipment [1m [0m [1m [0m [1m [0m [38;5;244m [0m [38;5;244m [0m Other [1m [0m[1;31m $(1,480)[0m[1m [0m [1m [0m[1;31m $(1,308)[0m[1m [0m [1m [0m[1;31m $(1,337)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Cash generated by investing activities [1m [0m[1m $15,195[0m[1m [0m [1m [0m[1m $2,935[0m[1m [0m [1m [0m[1m $3,705[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1mFinancing activities: [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1m Payments for taxes related to net share settlement of [0m [1m [0m[1;31m $(5,960)[0m[1m [0m [1m [0m[1;31m $(5,441)[0m[1m [0m [1m [0m[1;31m $(5,431)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [1mequity awards: [0m [1m [0m [1m [0m [1m [0m [38;5;244m [0m [38;5;244m [0m [2m Restricted stock units [0m [1m [0m[1;31m $(6,100)[0m[1m [0m [1m [0m[1;31m $(5,600)[0m[1m [0m [1m [0m[1;31m $(5,600)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Payments for dividends and dividend equivalents [1m [0m[1;31m $(15,421)[0m[1m [0m [1m [0m[1;31m $(15,234)[0m[1m [0m [1m [0m[1;31m $(15,025)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Repurchases of common stock [1m [0m[1;31m $(90,711)[0m[1m [0m [1m [0m[1;31m $(94,949)[0m[1m [0m [1m [0m[1;31m $(77,550)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Proceeds from issuance of term debt, net [1m [0m[1m $4,481[0m[1m [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m $5,228[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Repayments of term debt [1m [0m[1;31m $(10,932)[0m[1m [0m [1m [0m[1;31m $(9,958)[0m[1m [0m [1m [0m[1;31m $(11,151)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Proceeds from/(Repayments of) commercial paper, net [1m [0m[1;31m $(2,032)[0m[1m [0m [1m [0m[1m $3,960[0m[1m [0m [1m [0m[1;31m $(3,978)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Other [1m [0m[1;31m $(111)[0m[1m [0m [1m [0m[1;31m $(361)[0m[1m [0m [1m [0m[1;31m $(581)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Cash used in financing activities [1m [0m[1;31m $(120,686)[0m[1m [0m [1m [0m[1;31m $(121,983)[0m[1m [0m [1m [0m[1;31m $(108,488)[0m[1m [0m [38;5;244m [0m [38;5;244m [0m Increase/(Decrease) in cash, cash equivalents, and [1m [0m[1m $5,991[0m[1m [0m [1m [0m[1;31m $(794)[0m[1m [0m [1m [0m[1m $5,760[0m[1m [0m [38;5;244m [0m [38;5;244m [0m restricted cash and cash equivalents [1m [0m [1m [0m [1m [0m [38;5;244m [0m [38;5;244m [0m Cash, cash equivalents, and restricted cash and cash [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m equivalents, ending balances [1m [0m [1m [0m [1m [0m [38;5;244m [0m [38;5;244m [0m [1mSupplemental cash flow disclosure: [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [1m [0m[1m [0m[1m [0m [38;5;244m [0m [38;5;244m [0m Cash paid for income taxes, net [1m [0m[1m $43,369[0m[1m [0m [1m [0m[1m $26,102[0m[1m [0m [1m [0m[1m $18,679[0m[1m [0m [38;5;244m [0m [38;5;244m [0m [38;5;244m [0m [38;5;244m [0m[38;5;244m [0m[2;3;38;5;244mSource: [0m[38;5;220mSEC XBRL[0m[38;5;244m [0m[38;5;244m•[0m[38;5;244m [0m[2;38;5;244m(In millions, except shares and per share data)[0m[38;5;244m [0m[38;5;244m [0m[38;5;244m [0m
3.4 Working with Statement Data
The DataFrame format allows you to compute ratios and perform analysis.
# Extract specific line items from income statement
income_df = income.to_dataframe()
date_cols = [c for c in income_df.columns if c[0].isdigit()]
key_items = income_df[income_df["label"].str.contains("Revenue|Net income", case=False, na=False)]
key_items[["label", *date_cols]]Output
label 2025-09-27 (FY) 2024-09-28 (FY) 2023-09-30 (FY) 39 Net income 1.120100e+11 9.373600e+10 9.699500e+10
| label | 2025-09-27 (FY) | 2024-09-28 (FY) | 2023-09-30 (FY) | |
|---|---|---|---|---|
| 39 | Net income | 1.120100e+11 | 9.373600e+10 | 9.699500e+10 |
Part 4: Form 4 Insider Transactions
Form 4 reports insider trading activity. EdgarTools parses the XML into structured data.
# Get Tesla's Form 4 filings
tesla = Company("TSLA")
form4_filings = tesla.get_filings(form="4")
print(f"Tesla Form 4 filings: {len(form4_filings)}")Output
Tesla Form 4 filings: 802
# Parse the 10 most recent Form 4 filings into a tidy DataFrame.
# Some Form 4 XML is malformed at the source; capture parse failures rather than abort.
recent_form4s = form4_filings.head(10)
records = []
for filing in recent_form4s:
try:
form4 = filing.obj()
records.append(
{
"filing_date": str(filing.filing_date),
"insider": form4.insider_name or "Unknown",
"n_purchases": len(form4.common_stock_purchases),
"n_sales": len(form4.common_stock_sales),
"parse_error": None,
}
)
except Exception as exc:
records.append(
{
"filing_date": str(filing.filing_date),
"insider": None,
"n_purchases": None,
"n_sales": None,
"parse_error": str(exc)[:80],
}
)
insider_summary = pl.DataFrame(records)
insider_summaryOutput
shape: (10, 5) ┌─────────────┬──────────────────────────┬─────────────┬─────────┬─────────────┐ │ filing_date ┆ insider ┆ n_purchases ┆ n_sales ┆ parse_error │ │ --- ┆ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ str ┆ i64 ┆ i64 ┆ null │ ╞═════════════╪══════════════════════════╪═════════════╪═════════╪═════════════╡ │ 2026-06-17 ┆ Musk Elon ┆ 0 ┆ 0 ┆ null │ │ 2026-06-09 ┆ Vaibhav Taneja ┆ 0 ┆ 1 ┆ null │ │ 2026-05-15 ┆ Vaibhav Taneja ┆ 0 ┆ 1 ┆ null │ │ 2026-05-04 ┆ Kathleen Wilson-Thompson ┆ 0 ┆ 16 ┆ null │ │ 2026-04-23 ┆ Musk Elon ┆ 0 ┆ 0 ┆ null │ │ 2026-04-02 ┆ Xiaotong Zhu ┆ 0 ┆ 0 ┆ null │ │ 2026-04-01 ┆ Kathleen Wilson-Thompson ┆ 0 ┆ 15 ┆ null │ │ 2026-03-09 ┆ Vaibhav Taneja ┆ 0 ┆ 1 ┆ null │ │ 2026-02-27 ┆ Kathleen Wilson-Thompson ┆ 0 ┆ 7 ┆ null │ │ 2026-01-12 ┆ Xiaotong Zhu ┆ 0 ┆ 0 ┆ null │ └─────────────┴──────────────────────────┴─────────────┴─────────┴─────────────┘
| filing_date | insider | n_purchases | n_sales | parse_error |
|---|---|---|---|---|
| str | str | i64 | i64 | null |
| "2026-06-17" | "Musk Elon" | 0 | 0 | null |
| "2026-06-09" | "Vaibhav Taneja" | 0 | 1 | null |
| "2026-05-15" | "Vaibhav Taneja" | 0 | 1 | null |
| "2026-05-04" | "Kathleen Wilson-Thompson" | 0 | 16 | null |
| "2026-04-23" | "Musk Elon" | 0 | 0 | null |
| "2026-04-02" | "Xiaotong Zhu" | 0 | 0 | null |
| "2026-04-01" | "Kathleen Wilson-Thompson" | 0 | 15 | null |
| "2026-03-09" | "Vaibhav Taneja" | 0 | 1 | null |
| "2026-02-27" | "Kathleen Wilson-Thompson" | 0 | 7 | null |
| "2026-01-12" | "Xiaotong Zhu" | 0 | 0 | null |
# Detailed look at the first Form 4 in the window that contains stock sales.
# Wrap parsing in a guard so malformed XML doesn't abort the cell, and handle
# the case where no Form 4 in the recent window contains sales.
def _has_sales(f):
try:
return len(f.obj().common_stock_sales) > 0
except Exception:
return False
sale_filing = next((f for f in recent_form4s if _has_sales(f)), None)
if sale_filing is None:
print("No Form 4 with stock sales found in the recent window.")
form4 = None
else:
form4 = sale_filing.obj()
print(f"{form4.insider_name} — {sale_filing.filing_date}")
print(f"Issuer: {form4.issuer}")
form4.common_stock_sales if form4 is not None else NoneOutput
Vaibhav Taneja — 2026-06-09 Issuer: Issuer(cik='0001318605', name=Tesla, Inc., ticker=TSLA)
Security Date Shares Remaining Price AcquiredDisposed \ 1 Common Stock 2026-06-08 2605.5 22039.0 402.197 D DirectIndirect NatureOfOwnership form Code EquitySwap footnotes \ 1 D None 4 S False F2 TransactionType 1 Sale
| Security | Date | Shares | Remaining | Price | AcquiredDisposed | DirectIndirect | NatureOfOwnership | form | Code | EquitySwap | footnotes | TransactionType | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Common Stock | 2026-06-08 | 2605.5 | 22039.0 | 402.197 | D | D | None | 4 | S | False | F2 | Sale |
4.1 Form 4 Transaction Codes
| Code | Description |
|---|---|
| P | Open market purchase |
| S | Open market sale |
| A | Grant or award |
| M | Exercise of options |
| G | Gift |
| D | Disposition to issuer |
| F | Tax payment via shares |
Part 5: 13F Institutional Holdings
Form 13F-HR reports quarterly holdings for institutional investment managers with $100M+ in qualifying securities.
# Get Berkshire Hathaway's 13F filings
berkshire = Company("BRK-A")
thirteenf_filings = berkshire.get_filings(form="13F-HR")
print(f"Berkshire 13F-HR filings: {len(thirteenf_filings)}")Output
Berkshire 13F-HR filings: 210
# Get latest 13F
latest_13f = thirteenf_filings.latest()
holdings = latest_13f.obj()
print("=== Berkshire Hathaway Holdings ===")
print(f"Report Period: {holdings.report_period}")
print(f"Total Value: ${holdings.total_value:,.0f}")
print(f"Number of Holdings: {holdings.total_holdings}")Output
=== Berkshire Hathaway Holdings === Report Period: 2026-03-31 Total Value: $263,095,703,570 Number of Holdings: 90
# View holdings DataFrame — top 20 by reported market value.
holdings_df = holdings.holdings
top_holdings = holdings_df.nlargest(20, "Value")[["Issuer", "Class", "Value", "SharesPrnAmount"]]
top_holdingsOutput
Issuer Class Value SharesPrnAmount 0 APPLE INC COM 57843260493 227917808 1 AMERICAN EXPRESS CO COM 45859204536 151610700 2 COCA COLA CO COM 30420000000 400000000 3 BANK AMERICA CORP COM 25039178044 513624165 4 CHEVRON CORPORATION COM 17457364606 84375856 5 OCCIDENTAL PETE CORP COM 17221193015 264941431 6 ALPHABET INC CAP STK CL A 15600071913 54249798 7 CHUBB LTD SWITZ COM 11162836215 34249183 8 MOODYS CORP COM 10762190653 24669778 9 KRAFT HEINZ CO COM 7323527057 325634818 10 DAVITA INC COM 4626158909 30100585 11 KROGER CO COM 3618000000 50000000 12 SIRIUSXM HOLDINGS INC COMMON STOCK 2880548260 124807117 13 DELTA AIR LINES INC COM NEW 2646532635 39809456 14 VERISIGN INC COM 2232726597 8989880 15 CAPITAL ONE FINL CORP COM 1304374500 7150000 16 NEW YORK TIMES CO MTN BE CL A 1268219376 15146535 17 ALLY FINL INC COM 1137670000 29000000 18 ALPHABET INC CAP STK CL C 1028454775 3585215 19 LIBERTY LIVE HOLDINGS INC COM SHS SER C 996356028 10587143
| Issuer | Class | Value | SharesPrnAmount | |
|---|---|---|---|---|
| 0 | APPLE INC | COM | 57843260493 | 227917808 |
| 1 | AMERICAN EXPRESS CO | COM | 45859204536 | 151610700 |
| 2 | COCA COLA CO | COM | 30420000000 | 400000000 |
| 3 | BANK AMERICA CORP | COM | 25039178044 | 513624165 |
| 4 | CHEVRON CORPORATION | COM | 17457364606 | 84375856 |
| 5 | OCCIDENTAL PETE CORP | COM | 17221193015 | 264941431 |
| 6 | ALPHABET INC | CAP STK CL A | 15600071913 | 54249798 |
| 7 | CHUBB LTD SWITZ | COM | 11162836215 | 34249183 |
| 8 | MOODYS CORP | COM | 10762190653 | 24669778 |
| 9 | KRAFT HEINZ CO | COM | 7323527057 | 325634818 |
| 10 | DAVITA INC | COM | 4626158909 | 30100585 |
| 11 | KROGER CO | COM | 3618000000 | 50000000 |
| 12 | SIRIUSXM HOLDINGS INC | COMMON STOCK | 2880548260 | 124807117 |
| 13 | DELTA AIR LINES INC | COM NEW | 2646532635 | 39809456 |
| 14 | VERISIGN INC | COM | 2232726597 | 8989880 |
| 15 | CAPITAL ONE FINL CORP | COM | 1304374500 | 7150000 |
| 16 | NEW YORK TIMES CO MTN BE | CL A | 1268219376 | 15146535 |
| 17 | ALLY FINL INC | COM | 1137670000 | 29000000 |
| 18 | ALPHABET INC | CAP STK CL C | 1028454775 | 3585215 |
| 19 | LIBERTY LIVE HOLDINGS INC | COM SHS SER C | 996356028 | 10587143 |
5.1 Portfolio Concentration
Expressing each position as a share of total reported value shows how much of the portfolio the largest holdings command. A 13F is a natural starting point for concentration and crowding analysis, and Berkshire's is famously top-heavy.
# Share of total reported 13F value held by each of the ten largest positions.
# Aggregate by issuer first so multiple share classes of one name combine.
concentration = (
pl.from_pandas(holdings_df)
.group_by("Issuer")
.agg(pl.col("Value").sum())
.with_columns((pl.col("Value") / pl.col("Value").sum() * 100).alias("pct_portfolio"))
.sort("pct_portfolio", descending=True)
.head(10)
)
pct = concentration["pct_portfolio"].to_list()
issuers = [name.title() for name in concentration["Issuer"].to_list()]
top3, top4 = sum(pct[:3]), sum(pct[:4])
# Emphasise the three largest positions in amber; the rest provide context in blue.
bar_colors = [COLORS["amber"] if i < 3 else COLORS["blue"] for i in range(len(issuers))]
fig = go.Figure(
go.Bar(
x=pct,
y=issuers,
orientation="h",
marker_color=bar_colors,
text=[f"{p:.1f}%" for p in pct],
textposition="outside",
cliponaxis=False, # keep the outside label on the largest bar from clipping
)
)
fig.update_layout(
title=dict(
text="Berkshire's Top Three Positions Dominate Its 13F Portfolio"
f"<br><sup>As of {holdings.report_period}: top 3 = {top3:.0f}%, "
f"top 4 = {top4:.0f}% of reported value</sup>",
),
xaxis_title="Share of Reported 13F Value (%)",
xaxis=dict(range=[0, max(pct) * 1.12]), # headroom for the outside data labels
yaxis_title="",
yaxis=dict(autorange="reversed"), # largest position at the top
margin=dict(l=160, r=40, t=70, b=55), # room for long issuer names
height=430,
)
fig.show()Output
Part 6: Global Filing Search
Search across all SEC filers for specific form types.
# Get recent 10-K filings across all companies
recent_10ks = get_filings(form="10-K")
print(f"Recent 10-K filings available: {len(recent_10ks)}")Output
Recent 10-K filings available: 6529
# Filter by date
from datetime import date, timedelta
one_week_ago = date.today() - timedelta(days=7)
recent = get_filings(form="10-K", filing_date=f"{one_week_ago}:")
print(f"10-K filings in last week: {len(recent)}")
# Show a few
for filing in recent.head(5):
print(f"{filing.filing_date} | {filing.company[:40]}")Output
10-K filings in last week: 10 2026-07-10 | ADM TRONICS UNLIMITED, INC. 2026-07-10 | DeltaSoft Corp 2026-07-10 | Radiant Strategies Corp 2026-07-10 | Sports Entertainment Gaming Global Corp 2026-07-09 | Barnes & Noble Education, Inc.
Part 7: Accessing Filing Content
Beyond structured data, you can access the raw filing content.
# Get filing content
filing = apple.get_filings(form="10-K").latest()
# Available content methods
print("=== Filing Content Methods ===")
print("filing.text() - Plain text content")
print("filing.html() - HTML content")
print("filing.open() - Open in browser")
print("filing.attachments - List of attachments")Output
=== Filing Content Methods === filing.text() - Plain text content filing.html() - HTML content filing.open() - Open in browser filing.attachments - List of attachments
# Get text content (excerpt)
text_content = filing.text()
print(f"\n=== 10-K Text Excerpt ({len(text_content):,} chars total) ===")
print(text_content[:1000])Output
=== 10-K Text Excerpt (260,861 chars total) === UNITED STATES SECURITIES AND EXCHANGE COMMISSION Washington, D.C. 20549 FORM 10-K (Mark One) ☒ANNUAL REPORT PURSUANT TO SECTION 13 OR 15(d) OF THE SECURITIES EXCHANGE ACT OF 1934 For the fiscal year ended September 27, 2025 or ☐TRANSITION REPORT PURSUANT TO SECTION 13 OR 15(d) OF THE SECURITIES EXCHANGE ACT OF 1934 For the transition period from to. Commission File Number: 001-36743 Apple Inc. (Exact name of Registrant as specified in its charter) California 94-2404110 (State or other jurisdiction (I.R.S. Employer Identification No.) One Apple Park Way Cupertino, California 95014 (Address of principal executive offices) (Zip Code) ( 408 996-1010 (Registrant’s telephone number, including area code) Securities registered pursuan
# List attachments
print("\n=== Filing Attachments ===")
for i, attachment in enumerate(filing.attachments):
if i >= 10:
break
print(f"{i + 1}. {attachment.document}")Output
=== Filing Attachments === 1. aapl-20250927.htm 2. a10-kexhibit4109272025.htm 3. a10-kexhibit21109272025.htm 4. a10-kexhibit23109272025.htm 5. a10-kexhibit31109272025.htm 6. a10-kexhibit31209272025.htm 7. a10-kexhibit32109272025.htm 8. aapl-20250927.xsd 9. aapl-20250927_cal.xml 10. aapl-20250927_def.xml
Key Takeaways
- EdgarTools wraps the SEC EDGAR REST API with a Pythonic surface: companies, filings, parsed XBRL statements, and structured Form 4 / 13F objects.
- The library is well suited to interactive single-company workflows — a 10-K returns three years of income statement, balance sheet, and cash flow as ready-to-analyse DataFrames.
- Form 4 and 13F filings expose
common_stock_purchases,common_stock_sales, and aholdingsDataFrame that fits naturally into a portfolio-concentration analysis (Berkshire's top three positions — Apple, American Express, Coca-Cola — make up about 51% of reported value in this snapshot, and the top four exceed 60%). - For Form 4 insider-transaction XML parsing, see
03_sec_form4_insider_transactions; for cross-sectional XBRL fundamentals, use the Frames API (04_sec_xbrl_fundamentals). - PIT reminder: anything you build for backtesting must key off
filing_date, notperiod_end. EdgarTools surfaces both — use the former for the as-of timestamp.
