Skip to content

Commit fac09a6

Browse files
dgunningclaude
andcommitted
Update docs and notebooks to cover recent API additions
Fix contradictions (common-pitfalls said cash_flow_statement() doesn't work, but it does), update the landing page and notebook to use get_financials()/get_quarterly_financials() instead of deprecated patterns, and document six previously undocumented features across guides, cheat sheet, skill YAML, and notebooks: get_operating_income(), Filing.obj_type, search_concepts(), available_periods(), xbrl.notes(), xbrl.disclosures(). Also add financials section to Beginners-Guide notebook and troubleshooting for the new warning system. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2690246 commit fac09a6

10 files changed

Lines changed: 96 additions & 56 deletions

File tree

‎docs/common-pitfalls.md‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,14 @@ print(f"${revenue/1e9:.1f}B") # "$391.0B"
8989

9090
### The cash flow method is `cashflow_statement()`
9191

92-
The method name is `cashflow_statement()` (no underscore between "cash" and "flow"). All three statements follow the same pattern:
92+
The canonical method name is `cashflow_statement()` (no underscore between "cash" and "flow"). The alias `cash_flow_statement()` also works. All three statements follow the same pattern:
9393

9494
```python
9595
financials.income_statement() # Income statement
9696
financials.balance_sheet() # Balance sheet
97-
financials.cashflow_statement() # Cash flow statement (NOT cash_flow_statement)
97+
financials.cashflow_statement() # Cash flow statement (cash_flow_statement() also works)
9898
```
9999

100-
!!! note "Aliases on the Company object"
101-
The `Company` object also has a `cash_flow()` shortcut that works: `company.cash_flow()`. But on the `Financials` object, use `cashflow_statement()`.
102-
103100
---
104101

105102
## Filings

‎docs/guides/company-facts.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,25 @@ for item in stmt.iter_with_values():
369369
print(f"Low confidence: {item.label} ({item.confidence:.2f})")
370370
```
371371

372+
## Discovering Available Data
373+
374+
Not sure what a company reports? Use the discovery methods to explore before querying:
375+
376+
```python
377+
facts = company.get_facts()
378+
379+
# Search for concepts by keyword
380+
facts.search_concepts("revenue") # Find all revenue-related concepts
381+
facts.search_concepts("debt") # Find debt-related concepts
382+
383+
# See what periods have data for a concept
384+
facts.available_periods("Revenue") # List all periods with Revenue data
385+
```
386+
387+
These methods are especially useful when `get_fact()` returns `None` — the warnings will suggest using `search_concepts()` to find the right concept name and `available_periods()` to find valid periods.
388+
389+
Both period formats work interchangeably: `"2023-FY"` and `"FY 2023"` are equivalent.
390+
372391
## Advanced Usage
373392

374393
### Working with EntityFacts Directly
@@ -1043,6 +1062,15 @@ shares_value = facts.shares_outstanding # Direct numeric value
10431062

10441063
## Troubleshooting
10451064

1065+
**Q: `get_fact()` or `get_concept()` returned None — how do I find the right concept?**
1066+
A: These methods now emit a warning when a concept is not found, including suggestions for similar concept names. Use `search_concepts()` to find what the company actually reports, and `available_periods()` to see what periods have data:
1067+
1068+
```python
1069+
facts = company.get_facts()
1070+
facts.search_concepts("revenue") # Shows all revenue-related concepts
1071+
facts.available_periods("Revenue") # Shows periods with Revenue data
1072+
```
1073+
10461074
**Q: Why do some companies return None for financial statements?**
10471075
A: Not all companies have facts data available through the SEC API. This is normal for some entity types. The enhanced API provides better error handling and fallback strategies.
10481076

‎docs/guides/extract-statements.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,24 @@ print(comparison_df[['ticker', 'revenue_b', 'net_income_b', 'net_margin', 'roa']
504504

505505
The new standardized methods make cross-company analysis much more reliable and easier to implement!
506506

507+
## Notes and Disclosures
508+
509+
XBRL filings contain notes and disclosure sections beyond the primary financial statements. Access them with convenience methods:
510+
511+
```python
512+
xbrl = filing.xbrl()
513+
514+
# Browse all note sections (e.g., accounting policies, segment data)
515+
for note in xbrl.notes():
516+
print(note.title)
517+
518+
# Browse all disclosure sections (e.g., revenue disaggregation, debt details)
519+
for disc in xbrl.disclosures():
520+
print(disc.title)
521+
```
522+
523+
These return the same statement objects as `xbrl.statements`, filtered to notes and disclosures respectively.
524+
507525
## Advanced XBRL Features
508526

509527
### Access Raw XBRL Facts

‎docs/guides/financial-data.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ total_assets = financials.get_total_assets()
4242
|--------|---------|
4343
| `get_revenue()` | Total revenue / net sales |
4444
| `get_net_income()` | Net income |
45+
| `get_operating_income()` | Operating income / loss |
4546
| `get_total_assets()` | Total assets |
4647
| `get_total_liabilities()` | Total liabilities |
4748
| `get_stockholders_equity()` | Stockholders' equity |

‎docs/guides/working-with-filing.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,16 @@ if xbrl:
279279
print(income)
280280
```
281281

282+
### Preview the Data Object Type
283+
284+
Before calling `obj()`, you can check what type of object a filing will return:
285+
286+
```python
287+
filing.obj_type # e.g. 'TenK', 'ThirteenF', 'Form4', None
288+
```
289+
290+
This is useful for filtering filings to only those with structured data objects.
291+
282292
### Get Form-Specific Object
283293

284294
Get a structured object based on the form type:

‎docs/index.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ set_identity("your.name@email.com")
128128

129129
```python
130130
company = Company("TSLA")
131-
latest_10k = company.get_filings(form="10-K").latest()
132-
financials = latest_10k.obj().financials
131+
financials = company.get_financials()
132+
financials.income_statement()
133133
```
134134

135135
!!! tip "See it live on edgar.tools"

‎docs/quick-guide.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Common EdgarTools operations at a glance. For a step-by-step introduction, see t
3939
| 💸 Get the cash flow statement | `financials.cashflow_statement()` |
4040
| 💰 Get revenue | `financials.get_revenue()` |
4141
| 💵 Get net income | `financials.get_net_income()` |
42+
| 📊 Get operating income | `financials.get_operating_income()` |
4243
| 🐼 Export statement to DataFrame | `financials.income_statement().to_dataframe()` |
4344

4445
### Working with filings 📁
@@ -121,6 +122,7 @@ Common EdgarTools operations at a glance. For a step-by-step introduction, see t
121122
| 📊 Get the XBRL of the filing | `filing.xbrl()` |
122123
| 📝 Get the filing as markdown | `filing.markdown()` |
123124
| 📄 Get the full submission text | `filing.full_text_submission()` |
125+
| 🔍 Preview data object type | `filing.obj_type` |
124126
| 🔢 Get and parse filing data object | `filing.obj()` |
125127
| 📑 Get filing header | `filing.header` |
126128

‎edgar/ai/skills/financials/skill.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ patterns:
1818
code: |
1919
financials.get_revenue() # Total revenue
2020
financials.get_net_income() # Net income
21+
financials.get_operating_income() # Operating income
2122
financials.get_total_assets() # Total assets
2223
financials.get_total_liabilities() # Total liabilities
2324
financials.get_stockholders_equity() # Stockholders equity

‎notebooks/Beginners-Guide.ipynb‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cell_type": "markdown",
55
"id": "f02d4f2e-c44b-43f0-92fe-1c2d2f94d366",
66
"metadata": {},
7-
"source": "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/dgunning/edgartools/blob/main/notebooks/Beginners-Guide.ipynb)\n\n# Get Started with SEC Filings in Python -- Free, No API Key\n\nThis is the beginner's guide to **edgartools** -- the easiest way to work with SEC EDGAR data in Python. No API key or paid subscription required.\n\n**What you'll learn:**\n- Get SEC filings for any company by ticker symbol\n- Filter filings by form type, date range, and more\n- Select individual filings and explore their contents\n- Access company information and financial data"
7+
"source": "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/dgunning/edgartools/blob/main/notebooks/Beginners-Guide.ipynb)\n\n# Get Started with SEC Filings in Python -- Free, No API Key\n\nThis is the beginner's guide to **edgartools** -- the easiest way to work with SEC EDGAR data in Python. No API key or paid subscription required.\n\n**What you'll learn:**\n- Get SEC filings for any company by ticker symbol\n- Filter filings by form type, date range, and more\n- Select individual filings and explore their contents\n- Get financial statements and key metrics"
88
},
99
{
1010
"cell_type": "markdown",
@@ -382,6 +382,34 @@
382382
"source": [
383383
"filings.sample(5)"
384384
]
385+
},
386+
{
387+
"cell_type": "markdown",
388+
"id": "kq6e9qtmy4",
389+
"source": "## Get a Company's Financial Statements\n\nThe fastest way to get financial data is `get_financials()` — it finds the latest 10-K and parses the XBRL data automatically:",
390+
"metadata": {}
391+
},
392+
{
393+
"cell_type": "code",
394+
"id": "vckfvw30cas",
395+
"source": "company = Company(\"MSFT\")\nfinancials = company.get_financials()\n\nfinancials.income_statement()",
396+
"metadata": {},
397+
"execution_count": null,
398+
"outputs": []
399+
},
400+
{
401+
"cell_type": "markdown",
402+
"id": "v3vscbvyll9",
403+
"source": "## Extract Key Metrics\n\nPull specific numbers without reading the full statement:",
404+
"metadata": {}
405+
},
406+
{
407+
"cell_type": "code",
408+
"id": "2vbs2onq6tu",
409+
"source": "print(f\"Revenue: ${financials.get_revenue():>15,.0f}\")\nprint(f\"Net Income: ${financials.get_net_income():>15,.0f}\")\nprint(f\"Total Assets: ${financials.get_total_assets():>15,.0f}\")",
410+
"metadata": {},
411+
"execution_count": null,
412+
"outputs": []
385413
}
386414
],
387415
"metadata": {

‎notebooks/financial-statements-sec-python.ipynb‎

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -187,29 +187,15 @@
187187
"cell_type": "markdown",
188188
"id": "cell-quarterly-md",
189189
"metadata": {},
190-
"source": [
191-
"## Quarterly Financial Statements from 10-Q\n",
192-
"\n",
193-
"`get_financials()` returns the latest annual (10-K) filing. To get quarterly data, parse a 10-Q filing directly:"
194-
]
190+
"source": "## Quarterly Financial Statements from 10-Q\n\nUse `get_quarterly_financials()` to get the latest quarterly data in one line:"
195191
},
196192
{
197193
"cell_type": "code",
198194
"execution_count": null,
199195
"id": "cell-quarterly",
200196
"metadata": {},
201197
"outputs": [],
202-
"source": [
203-
"from edgar.financials import Financials\n",
204-
"\n",
205-
"# Get the latest 10-Q filing\n",
206-
"tenq = Company(\"AAPL\").get_filings(form=\"10-Q\")[0]\n",
207-
"print(f\"Filing: {tenq.form} filed {tenq.filing_date}\\n\")\n",
208-
"\n",
209-
"# Parse quarterly financials\n",
210-
"q_financials = Financials(tenq.xbrl())\n",
211-
"q_financials.income_statement()"
212-
]
198+
"source": "q_financials = Company(\"AAPL\").get_quarterly_financials()\n\nq_financials.income_statement()"
213199
},
214200
{
215201
"cell_type": "markdown",
@@ -276,38 +262,7 @@
276262
"cell_type": "markdown",
277263
"id": "cell-reference",
278264
"metadata": {},
279-
"source": [
280-
"## Quick Reference\n",
281-
"\n",
282-
"```python\n",
283-
"from edgar import *\n",
284-
"set_identity(\"your.name@example.com\")\n",
285-
"\n",
286-
"# ── Get financial statements (annual) ──\n",
287-
"financials = Company(\"AAPL\").get_financials()\n",
288-
"financials.income_statement() # Income statement\n",
289-
"financials.balance_sheet() # Balance sheet\n",
290-
"financials.cashflow_statement() # Cash flow statement\n",
291-
"\n",
292-
"# ── Key metrics ──\n",
293-
"financials.get_revenue() # Revenue\n",
294-
"financials.get_net_income() # Net income\n",
295-
"financials.get_total_assets() # Total assets\n",
296-
"financials.get_total_liabilities() # Total liabilities\n",
297-
"financials.get_stockholders_equity() # Shareholders' equity\n",
298-
"financials.get_financial_metrics() # Dict with ratios\n",
299-
"\n",
300-
"# ── Convert to DataFrame ──\n",
301-
"statement = financials.income_statement()\n",
302-
"df = statement.to_dataframe() # Full pandas DataFrame\n",
303-
"\n",
304-
"# ── Quarterly financials (from 10-Q) ──\n",
305-
"from edgar.financials import Financials\n",
306-
"tenq = Company(\"AAPL\").get_filings(form=\"10-Q\")[0]\n",
307-
"q_fin = Financials(tenq.xbrl())\n",
308-
"q_fin.income_statement() # Quarterly income statement\n",
309-
"```"
310-
]
265+
"source": "## Quick Reference\n\n```python\nfrom edgar import *\nset_identity(\"your.name@example.com\")\n\n# ── Get financial statements (annual) ──\nfinancials = Company(\"AAPL\").get_financials()\nfinancials.income_statement() # Income statement\nfinancials.balance_sheet() # Balance sheet\nfinancials.cashflow_statement() # Cash flow statement\n\n# ── Key metrics ──\nfinancials.get_revenue() # Revenue\nfinancials.get_net_income() # Net income\nfinancials.get_operating_income() # Operating income\nfinancials.get_total_assets() # Total assets\nfinancials.get_total_liabilities() # Total liabilities\nfinancials.get_stockholders_equity() # Shareholders' equity\nfinancials.get_financial_metrics() # Dict with ratios\n\n# ── Convert to DataFrame ──\nstatement = financials.income_statement()\ndf = statement.to_dataframe() # Full pandas DataFrame\n\n# ── Quarterly financials (from 10-Q) ──\nq_fin = Company(\"AAPL\").get_quarterly_financials()\nq_fin.income_statement() # Quarterly income statement\n```"
311266
},
312267
{
313268
"cell_type": "markdown",

0 commit comments

Comments
 (0)