api-data-fetcher
Fetch economic data from FRED, World Bank, and other APIs
What this skill does
# 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:
1. What data do you need? (GDP, unemployment, inflation, etc.)
2. What time period and frequency?
3. What countries/regions?
4. 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
```python
"""
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
# ============================================
def fetch_fred_series(
series_ids: List[str],
start_date: str = "2000-01-01",
end_date: Optional[str] = None,
api_key: Optional[str] = None
) -> pd.DataFrame:
"""
Fetch time series data from FRED.
Parameters
----------
series_ids : list of str
FRED series IDs (e.g., ['GDP', 'UNRATE', 'CPIAUCSL'])
start_date : str
Start date in YYYY-MM-DD format
end_date : str, optional
End date (defaults to today)
api_key : str, optional
FRED API key (defaults to FRED_API_KEY env var)
Returns
-------
pd.DataFrame
DataFrame with date index and series as columns
Example
-------
>>> df = fetch_fred_series(['GDP', 'UNRATE'], '2010-01-01')
"""
try:
from fredapi import Fred
except ImportError:
raise ImportError("Install fredapi: pip install fredapi")
# Get API key
api_key = api_key or os.environ.get('FRED_API_KEY')
if not api_key:
raise ValueError(
"FRED API key required. Set FRED_API_KEY environment variable "
"or pass api_key parameter. Get a key at: "
"https://fred.stlouisfed.org/docs/api/api_key.html"
)
fred = Fred(api_key=api_key)
end_date = end_date or datetime.now().strftime('%Y-%m-%d')
# Fetch each series
data = {}
for series_id in series_ids:
try:
series = fred.get_series(
series_id,
observation_start=start_date,
observation_end=end_date
)
data[series_id] = series
print(f"✓ Downloaded {series_id}")
except Exception as e:
print(f"✗ Failed to download {series_id}: {e}")
# Combine into DataFrame
df = pd.DataFrame(data)
df.index.name = 'date'
return df
# Common FRED series for economists
FRED_SERIES = {
# GDP and Output
'GDP': 'Gross Domestic Product',
'GDPC1': 'Real GDP',
'GDPPOT': 'Real Potential GDP',
# Labor Market
'UNRATE': 'Unemployment Rate',
'PAYEMS': 'Total Nonfarm Payrolls',
'CIVPART': 'Labor Force Participation Rate',
# Prices
'CPIAUCSL': 'Consumer Price Index',
'PCEPI': 'PCE Price Index',
'CPILFESL': 'Core CPI',
# Interest Rates
'FEDFUNDS': 'Federal Funds Rate',
'DGS10': '10-Year Treasury Rate',
'T10Y2Y': '10Y-2Y Treasury Spread',
# Money and Credit
'M2SL': 'M2 Money Stock',
'TOTRESNS': 'Total Reserves',
}
# ============================================
# World Bank Data Fetcher
# ============================================
def fetch_world_bank_data(
indicators: Dict[str, str],
countries: List[str] = ['USA', 'GBR', 'DEU', 'FRA', 'JPN'],
start_year: int = 2000,
end_year: Optional[int] = None
) -> pd.DataFrame:
"""
Fetch indicator data from World Bank.
Parameters
----------
indicators : dict
Dict mapping indicator codes to names
e.g., {'NY.GDP.PCAP.CD': 'gdp_per_capita'}
countries : list of str
ISO 3-letter country codes
start_year : int
Start year
end_year : int, optional
End year (defaults to current year)
Returns
-------
pd.DataFrame
Panel data with country and year
Example
-------
>>> indicators = {
... 'NY.GDP.PCAP.CD': 'gdp_per_capita',
... 'SP.POP.TOTL': 'population'
... }
>>> df = fetch_world_bank_data(indicators, ['USA', 'GBR'])
"""
try:
import wbdata
except ImportError:
raise ImportError("Install wbdata: pip install wbdata")
end_year = end_year or datetime.now().year
all_data = []
for indicator_code, indicator_name in indicators.items():
try:
# Fetch data
data = wbdata.get_dataframe(
{indicator_code: indicator_name},
country=countries,
)
data = data.reset_index()
all_data.append(data)
print(f"✓ Downloaded {indicator_name}")
except Exception as e:
print(f"✗ Failed to download {indicator_name}: {e}")
# Merge all indicators
if all_data:
df = all_data[0]
for other_df in all_data[1:]:
df = df.merge(other_df, on=['country', 'date'], how='outer')
# Filter years
df['year'] = pd.to_datetime(df['date']).dt.year
df = df[(df['year'] >= start_year) & (df['year'] <= end_year)]
return df
return pd.DataFrame()
# Common World Bank indicators
WORLD_BANK_INDICATORS = {
# Income and Growth
'NY.GDP.PCAP.CD': 'GDP per capita (current US$)',
'NY.GDP.PCAP.KD.ZG': 'GDP per capita growth (%)',
'NY.GDP.MKTP.KD.ZG': 'GDP growth (%)',
# Population
'SP.POP.TOTL': 'Population, total',
'SP.URB.TOTL.IN.ZS': 'Urban population (%)',
# Trade
'NE.TRD.GNFS.ZS': 'Trade (% of GDP)',
'BX.KLT.DINV.WD.GD.ZS': 'FDI, net inflows (% of GDP)',
# Human Capital
'SE.XPD.TOTL.GD.ZS': 'Education expenditure (% of GDP)',
'SH.XPD.CHEX.GD.ZS': 'Health expenditure (% of GDP)',
# Inequality
'SI.POV.GINI': 'Gini index',
'SI.POV.DDAY': 'Poverty headcount ratio ($1.90/day)',
}
# ============================================
# Usage Example
# ============================================
if __name__ == "__main__":
# Example 1: Fetch US macro data from FRED
us_macro = fetch_fred_series(
series_ids=['GDP', 'UNRATE', 'CPIAUCSL', 'FEDFUNDS'],
start_date='2010-01-01'
)
print("\nUS Macro Data (FRED):")
print(us_macro.tail())
# Save to CSV
us_macro.to_csv('data/us_macro_fred.csv')
print("\nSaved to data/us_macro_fred.csv")
# Example 2: Fetch cross-country data from World Bank
indicators = {
'NY.GDP.PCAP.CD': 'gdp_per_capita',
'SP.POP.TOTL': 'population',
'NY.GDP.MKTP.KD.ZG': 'gdp_growth'
}
cross_country = fetch_world_bank_data(
indicators=indicators,
countries=['USA', 'GBR', 'DEU', 'FRA', 'JPN', 'CHN', 'IND', 'BRA'],
start_year=2000
)
print("\nCross-Country Data (WorRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.