Every economist, data scientist, and financial analyst I know eventually discovers the same thing: the Federal Reserve Bank of St. Louis gives away 800,000+ economic time series for free.
GDP. Unemployment. Inflation. Interest rates. Housing prices. Consumer sentiment. All updated automatically, going back decades.
It's called FRED (Federal Reserve Economic Data), and its API is one of the best-kept secrets in data science.
What You Get
| Dataset | Data Points | History |
|---|---|---|
| GDP (quarterly) | 300+ observations | Since 1947 |
| Unemployment rate | 900+ monthly | Since 1948 |
| CPI (inflation) | 900+ monthly | Since 1947 |
| Federal funds rate | 800+ monthly | Since 1954 |
| S&P 500 | 1,500+ monthly | Since 1871 |
| Housing prices | 400+ monthly | Since 1987 |
| Consumer sentiment | 600+ monthly | Since 1952 |
Total: 816,000+ time series. All free. All via API.
Getting Started (2 Minutes)
Step 1: Get a free API key at fred.stlouisfed.org/docs/api/api_key.html
Step 2: Make your first request:
import requests
API_KEY = "your_api_key_here"
# Get US GDP data
url = "https://api.stlouisfed.org/fred/series/observations"
params = {
"series_id": "GDP",
"api_key": API_KEY,
"file_type": "json",
"sort_order": "desc",
"limit": 10
}
resp = requests.get(url, params=params)
data = resp.json()
for obs in data["observations"]:
print(f"{obs['date']}: ${obs['value']}B")
Output:
2025-10-01: $30234.4B
2025-07-01: $29719.4B
2025-04-01: $29567.5B
...
That's it. US GDP going back to 1947.
5 Useful Series IDs
Every FRED series has a short ID. Here are the ones you'll use most:
SERIES = {
"GDP": "Gross Domestic Product",
"UNRATE": "Unemployment Rate",
"CPIAUCSL": "Consumer Price Index (Inflation)",
"FEDFUNDS": "Federal Funds Rate",
"SP500": "S&P 500 Index",
"MORTGAGE30US": "30-Year Mortgage Rate",
"UMCSENT": "Consumer Sentiment Index",
"M2SL": "M2 Money Supply",
"T10YIE": "10-Year Breakeven Inflation Rate",
"DGS10": "10-Year Treasury Rate"
}
# Fetch any series
def get_fred_series(series_id, limit=10):
url = "https://api.stlouisfed.org/fred/series/observations"
params = {
"series_id": series_id,
"api_key": API_KEY,
"file_type": "json",
"sort_order": "desc",
"limit": limit
}
return requests.get(url, params=params).json()["observations"]
# Get current unemployment
for obs in get_fred_series("UNRATE", 5):
print(f"{obs['date']}: {obs['value']}%")
Search for Any Economic Indicator
Don't know the series ID? Search for it:
def search_fred(query, limit=5):
url = "https://api.stlouisfed.org/fred/series/search"
params = {
"search_text": query,
"api_key": API_KEY,
"file_type": "json",
"limit": limit
}
resp = requests.get(url, params=params)
for s in resp.json()["seriess"]:
print(f"{s['id']:20s} | {s['title'][:60]}")
print(f"{'':20s} | Updated: {s['last_updated'][:10]}")
print()
search_fred("bitcoin")
search_fred("rent prices")
search_fred("tech employment")
Real-World Use Case: Recession Indicator
Here's something actually useful — a simple recession probability tracker:
def recession_check():
"""Check key recession indicators."""
indicators = {
"T10Y2Y": "10Y-2Y Treasury Spread (negative = inverted yield curve)",
"UNRATE": "Unemployment Rate (rising = warning)",
"ICSA": "Initial Jobless Claims (rising = warning)",
"UMCSENT": "Consumer Sentiment (falling = warning)"
}
print("\n📊 Recession Indicator Dashboard\n")
for series_id, desc in indicators.items():
obs = get_fred_series(series_id, 2)
if len(obs) >= 2:
current = float(obs[0]["value"]) if obs[0]["value"] != "." else 0
previous = float(obs[1]["value"]) if obs[1]["value"] != "." else 0
change = current - previous
arrow = "🔴" if (series_id in ["UNRATE", "ICSA"] and change > 0) or \
(series_id in ["T10Y2Y", "UMCSENT"] and change < 0) else "🟢"
print(f"{arrow} {series_id}: {current} ({change:+.2f})")
print(f" {desc}\n")
recession_check()
Rate Limits & Pricing
| Plan | Requests | Cost |
|---|---|---|
| Free | 120 req/min | $0 |
Yes, that's it. Free tier is incredibly generous — 120 requests per minute is more than enough for any project.
Why FRED Over Alternatives?
- Yahoo Finance API — deprecated, unofficial wrappers break often
- Alpha Vantage — 5 req/min free tier, limited history
- Quandl — acquired by Nasdaq, free tier shrinking
- FRED — government-funded, stable, 120 req/min, 76 years of data
FRED has been running since 1991. It's not going anywhere.
Full Python Wrapper
I built a complete tool: fred-economic-data on GitHub
It wraps all FRED endpoints with clean Python functions — search, fetch, compare series, export to CSV.
What economic data do you work with? Have you used FRED before, or is there another API you prefer for financial data? I'm curious what tools people are actually using for economic analysis.
Part of my Free APIs You Didn't Know About series — I'm documenting every useful free API I find.\n\n---\n\n## More Free Research APIs\n\nThis is part of my series on free APIs for researchers and data scientists:\n\n- OpenAlex API — 250M+ Academic Works\n- CORE API — 260M+ Scientific Papers\n- Crossref API — DOI Metadata for 150M+ Papers\n- Unpaywall API — Find Free Paper Versions\n- Europe PMC — 40M+ Biomedical Papers\n- World Bank API — GDP & Economic Data\n- ORCID API — 18M+ Researcher Profiles\n- DBLP API — 6M+ CS Publications\n- NASA APIs — 20+ Free Space Data APIs\n- FRED API — 800K+ US Economic Time Series\n- All 30+ Research APIs Mapped\n\n*Tools: Academic Research Toolkit on GitHub*
Top comments (0)