Financial Modeling Prep (FMP) API Integration
Comprehensive financial data API specializing in fundamental analysis, SEC filings, institutional holdings (13F), congressional trading data, and pre-computed valuations.
Quick Start
Authentication
# Environment variable (recommended)
export FMP_API_KEY="your_api_key"
# Or in .env file
FMP_API_KEY=your_api_key
Basic Usage (Python)
import requests
import os
API_KEY = os.getenv("FMP_API_KEY")
BASE_URL = "https://financialmodelingprep.com/stable"
def get_quote(symbol: str) -> dict:
"""Get real-time quote for a symbol."""
response = requests.get(
f"{BASE_URL}/quote",
params={"symbol": symbol, "apikey": API_KEY}
)
data = response.json()
return data[0] if data else {}
# Example
quote = get_quote("AAPL")
print(f"AAPL: ${quote['price']:.2f} ({quote['changePercentage']:+.2f}%)")
Important: New Endpoint Format
FMP migrated to /stable/ endpoints. Legacy /api/v3/ endpoints require existing subscriptions.
# NEW format (use this)
BASE_URL = "https://financialmodelingprep.com/stable"
# OLD format (legacy only)
# BASE_URL = "https://financialmodelingprep.com/api/v3"
API Endpoints Reference
Stock Quotes & Prices
| Endpoint | Description | Free |
|---|
/quote | Real-time quote | ✅ |
/quote-short | Quick price | ✅ |
/historical-price-eod/full | Historical EOD | ✅ |
/historical-price-intraday | Intraday prices | ⚠️ Paid |
/pre-post-market-quote | Extended hours | ⚠️ Paid |
Financial Statements
| Endpoint | Description | Free |
|---|
/income-statement | Income statement | ✅ |
/balance-sheet-statement | Balance sheet | ✅ |
/cash-flow-statement | Cash flow | ✅ |
/income-statement-growth | Income growth | ✅ |
/key-metrics | Key metrics | ✅ |
/financial-ratios | Financial ratios | ✅ |
/enterprise-values | Enterprise value | ✅ |
Valuations & Analysis
| Endpoint | Description | Free |
|---|
/discounted-cash-flow | DCF valuation | ✅ |
/historical-discounted-cash-flow | Historical DCF | ✅ |
/rating | Company rating | ✅ |
/historical-rating | Rating history | ✅ |
/company-outlook | Full company data | ✅ |
Institutional & Insider Data
| Endpoint | Description | Free |
|---|
/institutional-holder | Institutional owners | ⚠️ Paid |
/mutual-fund-holder | Mutual fund owners | ⚠️ Paid |
/insider-trading | Insider transactions | ⚠️ Paid |
/form-13f | 13F filings | ⚠️ Paid |
/senate-trading | Senate trades | ⚠️ Paid |
/house-trading | House trades | ⚠️ Paid |
Screening & Discovery
| Endpoint | Description | Free |
|---|
/stock-screener | Screen stocks | ⚠️ Paid |
/stock-grade | Stock grades | ✅ |
/search | Search symbols | ✅ |
/search-name | Search by name | ✅ |
/profile | Company profile | ✅ |
Calendars & Events
| Endpoint | Description | Free |
|---|
/earnings-calendar | Earnings dates | ✅ |
/ipo-calendar | IPO dates | ✅ |
/stock-dividend-calendar | Dividends | ✅ |
/stock-split-calendar | Stock splits | ✅ |
/economic-calendar | Economic events | ✅ |
SEC Filings
| Endpoint | Description | Free |
|---|
/sec-filings | All SEC filings | ✅ |
/rss-feed-sec-filings | SEC RSS feed | ✅ |
Rate Limits
| Tier | Calls/Day | Calls/Min | Price |
|---|
| Free | 250 | N/A | $0 |
| Starter | Unlimited | 300 | $22/mo |
| Premium | Unlimited | 750 | $59/mo |
| Ultimate | Unlimited | 3,000 | $149/mo |
Free tier limitations:
- ~100 sample symbols (AAPL, TSLA, AMZN, etc.)
- End-of-day data only
- 500MB bandwidth (30-day rolling)
Common Tasks
Task: Get Financial Statements
def get_financials(symbol: str, period: str = "annual") -> dict:
"""Get comprehensive financial statements."""
income = requests.get(
f"{BASE_URL}/income-statement",
params={"symbol": symbol, "period": period, "apikey": API_KEY}
).json()
balance = requests.get(
f"{BASE_URL}/balance-sheet-statement",
params={"symbol": symbol, "period": period, "apikey": API_KEY}
).json()
cashflow = requests.get(
f"{BASE_URL}/cash-flow-statement",
params={"symbol": symbol, "period": period, "apikey": API_KEY}
).json()
return {
"income_statement": income[0] if income else {},
"balance_sheet": balance[0] if balance else {},
"cash_flow": cashflow[0] if cashflow else {}
}
# Example
financials = get_financials("AAPL")
print(f"Revenue: ${financials['income_statement'].get('revenue', 0):,.0f}")
Task: Get Key Metrics & Ratios
def get_key_metrics(symbol: str) -> dict:
"""Get important financial metrics.
...