SEC EDGAR (Electronic Data Gathering, Analysis, and Retrieval) is the U.S. Securities and Exchange Commission's official filing system. ALL public companies are required to file their financials here.
| Feature | SEC EDGAR | Paid APIs (FMP, Alpha Vantage, etc.) |
|---|---|---|
| Cost | 100% FREE ✅ | $50-500+/month |
| Rate Limits | ~10 requests/second | 25-250 calls/day (free tier) |
| Data Quality | Official source 🏛️ | Third-party aggregation |
| Historical Data | Complete history | Often limited |
| Coverage | All US public companies | Varies by tier |
| API Key | Not required ✅ | Required |
| Metric | Description | Already Have? |
|---|---|---|
| Revenue | Total revenue | ✅ YES |
| Net Income | Earnings (profit) | ✅ YES |
| Gross Profit | Revenue - COGS | ❌ Can add |
| Operating Income | Profit from operations | ❌ Can add |
| Cost of Revenue | Cost of goods/services | ❌ Can add |
| R&D Expense | Research & Development spending | ❌ Can add |
| SG&A Expense | Sales, General & Administrative | ❌ Can add |
| Interest Expense | Cost of debt | ❌ Can add |
| Tax Expense | Income tax paid | ❌ Can add |
| EPS (Basic) | Earnings Per Share | ❌ Can add |
| EPS (Diluted) | Diluted Earnings Per Share | ❌ Can add |
| Metric | Description | Already Have? |
|---|---|---|
| Total Assets | Everything company owns | ❌ Can add |
| Total Liabilities | Everything company owes | ❌ Can add |
| Stockholders Equity | Net worth | ❌ Can add |
| Current Assets | Assets < 1 year | ❌ Can add |
| Current Liabilities | Debts < 1 year | ❌ Can add |
| Cash & Equivalents | Liquid cash | ❌ Can add |
| Inventory | Goods in stock | ❌ Can add |
| Accounts Receivable | Money owed to company | ❌ Can add |
| Property/Plant/Equipment | Physical assets | ❌ Can add |
| Goodwill | Intangible value | ❌ Can add |
| Long-term Debt | Debt > 1 year | ❌ Can add |
| Metric | Description | Already Have? |
|---|---|---|
| Operating Cash Flow | Cash from operations | ❌ Can add |
| Investing Cash Flow | Cash from investments | ❌ Can add |
| Financing Cash Flow | Cash from financing | ❌ Can add |
| CapEx | Capital Expenditures | ✅ YES |
| Free Cash Flow | Operating CF - CapEx | ❌ Can add |
| Depreciation | Asset value reduction | ❌ Can add |
| Dividends Paid | Cash paid to shareholders | ❌ Can add |
| Metric | Description | Can Calculate? |
|---|---|---|
| Shares Outstanding | Total shares | ✅ From SEC |
| Market Cap | Stock price × shares | ✅ Already have |
| P/E Ratio | Price / Earnings | ✅ Can calculate |
| Debt-to-Equity | Liabilities / Equity | ✅ Can calculate |
| Current Ratio | Current Assets / Current Liabilities | ✅ Can calculate |
| ROE | Net Income / Equity | ✅ Can calculate |
| Profit Margin | Net Income / Revenue | ✅ Can calculate |
| Operating Margin | Operating Income / Revenue | ✅ Can calculate |
Add a few more key metrics to each card:
Apple Inc. (AAPL)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Revenue: $394.33B
Earnings: $101.96B ← Already added ✅
Operating Income: $123.22B ← New!
Free Cash Flow: $108.80B ← New!
CapEx: $11.10B ← Already have ✅
Total Assets: $364.98B ← New!
Debt-to-Equity: 5.41 ← New!
Market Cap: $3.15T ← Already have ✅
Add a new page showing detailed financials:
- Income Statement Tab: Revenue, earnings, margins
- Balance Sheet Tab: Assets, liabilities, equity
- Cash Flow Tab: Operating, investing, financing CF
- Metrics Tab: Ratios, per-share data
Compare financial metrics across companies:
Compare: AAPL vs MSFT vs GOOGL
Revenue: $394B $245B $331B
Earnings: $102B $88B $74B
Operating Margin: 31.3% 45.1% 32.0%
Free Cash Flow: $109B $73B $69B
Show historical trends using Chart.js or similar:
- Revenue growth over time
- Margin trends
- Cash flow trends
- R&D spending vs competitors
Here's what you could fetch and display:
def fetch_enhanced_financials(symbol):
"""Fetch comprehensive financials from SEC EDGAR"""
metrics_to_fetch = {
# Already have
'revenue': 'RevenueFromContractWithCustomerExcludingAssessedTax',
'earnings': 'NetIncomeLoss',
'capex': 'PaymentsToAcquirePropertyPlantAndEquipment',
# New additions
'gross_profit': 'GrossProfit',
'operating_income': 'OperatingIncomeLoss',
'operating_cash_flow': 'NetCashProvidedByUsedInOperatingActivities',
'total_assets': 'Assets',
'total_liabilities': 'Liabilities',
'stockholders_equity': 'StockholdersEquity',
'long_term_debt': 'LongTermDebt',
'cash': 'CashAndCashEquivalentsAtCarryingValue',
'rd_expense': 'ResearchAndDevelopmentExpense',
'shares_outstanding': 'CommonStockSharesOutstanding',
'dividends_paid': 'PaymentsOfDividends'
}
# Fetch from SEC EDGAR API
# ... (implementation)Then display:
// Enhanced company card
<div class="company-card">
<h3>${company.name}</h3>
<!-- Profitability -->
<div class="metric-group">
<h4>💰 Profitability</h4>
<div>Revenue: ${formatCurrency(company.revenue)}</div>
<div>Earnings: ${formatCurrency(company.earnings)}</div>
<div>Operating Income: ${formatCurrency(company.operating_income)}</div>
<div>Profit Margin: ${(company.earnings/company.revenue*100).toFixed(1)}%</div>
</div>
<!-- Cash Flow -->
<div class="metric-group">
<h4>💵 Cash Flow</h4>
<div>Operating CF: ${formatCurrency(company.operating_cash_flow)}</div>
<div>CapEx: ${formatCurrency(company.capex)}</div>
<div>Free CF: ${formatCurrency(company.operating_cash_flow + company.capex)}</div>
</div>
<!-- Balance Sheet -->
<div class="metric-group">
<h4>📊 Balance Sheet</h4>
<div>Total Assets: ${formatCurrency(company.total_assets)}</div>
<div>Total Debt: ${formatCurrency(company.long_term_debt)}</div>
<div>Equity: ${formatCurrency(company.stockholders_equity)}</div>
<div>Debt/Equity: ${(company.long_term_debt/company.stockholders_equity).toFixed(2)}</div>
</div>
<!-- Valuation -->
<div class="metric-group">
<h4>📈 Valuation</h4>
<div>Market Cap: ${formatCurrency(company.market_cap)}</div>
<div>P/E Ratio: ${(company.market_cap/company.earnings).toFixed(2)}</div>
<div>EPS: $${(company.earnings/company.shares_outstanding).toFixed(2)}</div>
</div>
</div>Update fetch-earnings-free.py to fetch more metrics:
def fetch_comprehensive_data(symbol):
"""Fetch all useful metrics from SEC EDGAR"""
cik = get_company_cik(symbol)
url = f"https://data.sec.gov/api/xbrl/companyfacts/CIK{cik}.json"
# Define what to extract
metrics = {
'gross_profit': 'GrossProfit',
'operating_income': 'OperatingIncomeLoss',
'operating_cash_flow': 'NetCashProvidedByUsedInOperatingActivities',
'total_assets': 'Assets',
'total_liabilities': 'Liabilities',
'stockholders_equity': 'StockholdersEquity',
'long_term_debt': 'LongTermDebt',
'cash': 'CashAndCashEquivalentsAtCarryingValue',
'rd_expense': 'ResearchAndDevelopmentExpense'
}
# Extract latest annual data for each metric
# ...Update financial_data.json structure:
{
"symbol": "AAPL",
"name": "Apple Inc.",
"capex": -11100000000,
"year": 2024,
"revenue": 394328000000,
"earnings": 101956000000,
"gross_profit": 180680000000, ← New
"operating_income": 123220000000, ← New
"operating_cash_flow": 118250000000, ← New
"total_assets": 364980000000, ← New
"total_liabilities": 308030000000, ← New
"stockholders_equity": 56950000000, ← New
"long_term_debt": 96660000000, ← New
"cash": 29940000000, ← New
"rd_expense": 31370000000, ← New
"sector": "Technology",
"market_cap": 3153843528000
}Add display logic to show additional metrics.
- ✅ Operating Income - Shows operational efficiency
- ✅ Operating Cash Flow - Shows cash generation
- ✅ Total Assets - Shows company size
- ✅ Debt-to-Equity Ratio - Shows financial leverage
- Free Cash Flow (Operating CF - CapEx)
- Profit Margins (calculate from existing data)
- P/E Ratio (Market Cap / Earnings)
- Detailed financial modal (click for more info)
- Historical trends (multi-year comparison)
- Sector benchmarking (vs sector averages)
- Financial health score (composite metric)
- Interactive charts (Chart.js or D3.js)
- SEC EDGAR API Docs: https://www.sec.gov/edgar/sec-api-documentation
- Company Search: https://www.sec.gov/cgi-bin/browse-edgar
- XBRL Taxonomy: https://www.sec.gov/structureddata/osd-inline-xbrl.html
Try the explorer tool:
# Explore what's available for any company
python3 explore-sec-data.py AAPL
python3 explore-sec-data.py TSLA
python3 explore-sec-data.py MSFT- SEC EDGAR: $0/month ✅
- Coverage: 99/102 companies
- Metrics: 500+ per company
- Financial Modeling Prep Pro: $49/month
- Alpha Vantage Premium: $49.99/month
- Polygon.io Starter: $99/month
Savings: $49-99/month = $588-1,188/year 💰
SEC EDGAR is MORE POWERFUL than most paid APIs because it's the official source. The only limitation is it's US companies only and not real-time (quarterly/annual updates).
For your use case (S&P 100 companies with fundamental data), SEC EDGAR is perfect and 100% free!