
API Data Fetcher
Fetch economic data from FRED, World Bank, and other APIs
Install
npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill api-data-fetcher -g -a claude-code -y- Repository
- brycewang-stanford/Auto-Empirical-Research-Skills4.9k
- Category
- Engineering
- Updated
- 5d ago
- License
- See repository
- Context cost
- Mediumabout 2,328 tokens
- Runs scripts
- No, instructions only
What it does
Fetch economic data from FRED, World Bank, and other APIs
API Data Fetcher
Purpose
This skill helps economists fetch data from major economic data APIs including FRED (Federal Reserve Economic Data), World Bank, IMF, BLS, and OECD. It generates clean, documented Python code with proper error handling.
When to Use
- Downloading macroeconomic indicators
- Building custom datasets from multiple sources
- Automating data updates for ongoing projects
- Fetching cross-country panel data
Instructions
Step 1: Identify Data Requirements
Ask the user:
- What data do you need? (GDP, unemployment, inflation, etc.)
- What time period and frequency?
- What countries/regions?
- Preferred output format? (CSV, DataFrame, etc.)
Step 2: Select Appropriate API
| Data Type | Best Source | Package |
|---|---|---|
| US macro | FRED | fredapi |
| Global development | World Bank | wbdata |
| Labor statistics | BLS | bls |
| Cross-country | OECD | pandasdmx |
| Financial | Yahoo Finance | yfinance |
Step 3: Generate Clean Code
Include:
- API key handling (environment variables)
- Error handling for API failures
- Data cleaning and formatting
- Documentation of series definitions
Example Output
"""
Economic Data Fetcher
=====================
Downloads macroeconomic data from FRED and World Bank APIs.
Requires: fredapi, wbdata, pandas
Setup: Set FRED_API_KEY environment variable
Get a free key from: https://fred.stlouisfed.org/docs/api/api_key.html
"""
import os
import pandas as pd
from datetime import datetime, timedelta
from typing import List, Optional, Dict
# ============================================
# FRED Data Fetcher
# ============================================
