Economic Data API Guide经济数据 API 指南

Choose a Free Economic Data API
for Reliable Indicators
选择可靠的
免费经济数据 API

Compare official macroeconomic data APIs for GDP, inflation, rates, jobs, and trade—then build a reliable Python or agent workflow.

比较 GDP、通胀、利率、就业与贸易数据接口,
再构建可靠的 Python 或 AI Agent 工作流。

Whiteboard workflow for choosing a free economic data API by indicators, coverage, authentication, formats, provenance, and revisions

Free economic data API: quick answer免费经济数据 API:快速结论

Best starting point

Use FRED for deep US coverage, World Bank or IMF for cross-country indicators, Eurostat for EU data, and DBnomics to search across providers.

Free does not mean identical

Authentication, coverage, formats, rate limits, licensing, update schedules, and revision history vary by source.

Validate before use

Check units, frequency, seasonal adjustment, geography, release date, missing values, and whether observations may be revised.

QVeris role

QVeris helps agents and developers discover and inspect relevant data capabilities before calling the provider that fits the task.

优先从官方源开始

美国数据可先看 FRED,跨国指标看世界银行或 IMF,欧盟统计看 Eurostat,跨来源搜索可用 DBnomics。

免费不等于完全相同

不同接口的鉴权、覆盖、格式、调用限制、许可、更新节奏和修订历史并不一致。

使用前必须验证

检查单位、频率、季调状态、地区、发布日期、缺失值,以及数据是否会在发布后修订。

QVeris 的作用

QVeris 帮助开发者与 Agent 先查找并检查合适的数据能力,再调用符合任务要求的提供方。

What a free economic data API should provide免费经济数据 API 应该提供什么

Economic data is not one homogeneous dataset. A single research question may combine quarterly GDP, monthly inflation, weekly claims, daily interest rates, and event dates from several institutions. The API must expose enough metadata to explain how those series differ. A value without its unit, frequency, geography, seasonal-adjustment status, source, and release date is difficult to compare and unsafe to automate.

经济数据并不是一个统一同质的数据集。一个研究问题可能同时用到季度 GDP、月度通胀、每周失业救济申请、每日利率,以及来自多个机构的发布时间。API 必须提供足够的元数据来解释这些序列的差异。缺少单位、频率、地区、季调状态、来源和发布日期的数值,很难比较,也不适合直接自动化。

Start by defining the decision the data must support. A country-comparison dashboard needs harmonized annual indicators and stable country codes. A monetary-policy monitor needs release calendars, policy rates, inflation components, and revision timestamps. A historical model needs the values that were available at each past decision date, not only the latest revised series.

首先要明确这些数据将支持什么决策。跨国比较看板需要口径较统一的年度指标和稳定的国家代码;货币政策监控需要发布日历、政策利率、通胀分项和修订时间;历史模型则需要过去每个决策时点当时能够获得的数值,而不只是今天看到的最新修订序列。

Core economic data categories核心经济数据类别

Growth and national accounts

GDP, GDP per capita, consumption, investment, government spending, inventories, and trade. Verify nominal versus real values, base year, annualized rates, and expenditure versus production approaches.

Prices and inflation

CPI, PCE, producer prices, import prices, inflation expectations, and component indexes. Record index base, weighting method, headline versus core definition, and seasonal adjustment.

Labor market

Employment, unemployment, participation, earnings, vacancies, hours, and claims. Distinguish household surveys, establishment surveys, administrative records, and later benchmark revisions.

Money, credit, and interest rates

Policy rates, government yields, money supply, bank credit, financial conditions, and exchange rates. Preserve instrument, maturity, fixing convention, market date, and frequency.

Production, trade, and business activity

Industrial production, capacity utilization, retail sales, business surveys, exports, imports, and commodity indicators. Check whether values are levels, indexes, balances, or growth rates.

Population and development

Population, income, poverty, education, health, infrastructure, and development indicators. These are often annual, may have long publication lags, and require careful geographic comparability.

增长与国民账户

GDP、人均 GDP、消费、投资、政府支出、库存和贸易。需区分名义值与实际值、基年、年化增速,以及支出法或生产法口径。

物价与通胀

CPI、PCE、生产者价格、进口价格、通胀预期和分项指数。要记录指数基期、权重方法、总体或核心定义以及季调状态。

劳动力市场

就业、失业率、参与率、工资、职位空缺、工时和失业救济申请。需要区分家庭调查、企业调查、行政记录和后续基准修订。

货币、信贷与利率

政策利率、国债收益率、货币供应、银行信贷、金融条件和汇率。应保留工具类型、期限、定价惯例、市场日期和频率。

生产、贸易与商业活动

工业生产、产能利用率、零售销售、商业调查、进出口和大宗商品指标。要确认数值属于绝对水平、指数、调查差额还是增长率。

人口与发展

人口、收入、贫困、教育、健康、基础设施和发展指标。这类数据通常是年度频率,发布滞后较长,也更需要注意地区可比性。

Match the source to the job让数据源与任务匹配

Workflow工作流Data requirement数据要求Most important check最重要的检查Typical failure常见失败
Country dashboard国家比较看板Harmonized annual or quarterly indicators.口径统一的年度或季度指标。Country codes, units, comparable definitions.国家代码、单位和可比定义。Comparing years or definitions that do not align.比较不一致的年份或指标定义。
Policy monitor政策监控High-frequency releases and event calendar.高频数据发布和事件日历。Release timestamp, revision, source agency.发布时间、修订和来源机构。Treating observation period as release time.把统计期误当成公布时间。
Historical model历史模型Vintage or point-in-time observations.历史版本或时点观测。What was known on each decision date.每个决策日当时已知的信息。Look-ahead bias from revised values.使用修订值造成前视偏差。
AI research agentAI 研究 AgentValues plus metadata, citations, and errors.数值、元数据、引用和错误状态。Provenance, definitions, deterministic retrieval.来源、定义和可重复获取。Returning a number without unit or date.返回数字却没有单位或日期。

Compare free economic data API sources比较免费经济数据 API 来源

Source来源Best fit适合场景Key / format鉴权 / 格式Important caveat重要限制
FREDDeep US and selected global economic time series.美国及部分全球经济时间序列。Free key; JSON/XML.免费 Key;JSON/XML。Series definitions and revisions must be checked.必须核对序列定义与修订。
World BankCross-country development and macro indicators.跨国发展与宏观指标。No key; JSON/XML.无需 Key;JSON/XML。Many series are annual and can lag releases.不少序列为年度频率且存在发布时滞。
IMF DataMapperGlobal macro indicators and WEO-style comparisons.全球宏观指标与 WEO 类跨国比较。No key; JSON.无需 Key;JSON。Coverage differs by indicator and economy.不同指标与经济体覆盖不一。
EurostatOfficial EU statistics and detailed dimensions.欧盟官方统计与多维数据。No key; JSON-stat/SDMX.无需 Key;JSON-stat/SDMX。Dimension codes require careful handling.需要正确处理维度代码。
DBnomicsDiscovery across many official providers.跨多个官方提供方搜索数据。No key; JSON.无需 Key;JSON。Keep the original provider and series metadata.必须保留原始提供方和序列元数据。

Use FRED when US series depth and release metadata matter需要美国序列深度与发布元数据时使用 FRED

FRED is often the practical starting point for US macroeconomic research because it organizes observations by series, source, category, and release. Its documentation exposes endpoints for series observations, release dates, updates, and vintage dates; those separate routes are useful when a project must distinguish the observation period from the date a value became available. FRED also republishes series from multiple institutions, so preserve both the FRED series ID and the original source shown in the metadata.

FRED 通常是美国宏观研究的实用起点,因为它按序列、来源、类别和发布项目组织观测。官方文档提供序列观测、发布日期、更新和历史版本日期等接口;当项目必须区分统计期与数值实际可用日期时,这些独立接口非常重要。FRED 还会转载多个机构的序列,因此应同时保存 FRED 序列 ID 和元数据中标明的原始来源。

Choose the series-level workflow when you need incremental updates for a known indicator. Use release-oriented or bulk access when a pipeline needs many series from the same release. Do not infer that every FRED series shares one revision schedule, frequency, or licensing condition—the source notes and series metadata remain part of the data contract.

已知指标并需要增量更新时,可采用序列级工作流;同一发布项目下需要大量序列时,则考虑按发布项目或批量获取。不能假设所有 FRED 序列共享相同的修订周期、频率或许可条件,来源注释和序列元数据仍属于数据契约的一部分。

Use the World Bank for accessible cross-country indicators需要易接入的跨国指标时使用世界银行

The World Bank Indicators API is well suited to country dashboards, development research, and prototypes because its V2 endpoints support country and indicator filters and official documentation says authentication is not required. The response includes pagination metadata plus observation records, which makes it straightforward to retrieve a bounded country-period panel. The main trade-off is timing: many development indicators are annual and may appear after a substantial collection and harmonization lag.

世界银行指标 API 适合国家看板、发展研究和原型开发,因为 V2 接口支持国家与指标筛选,且官方文档说明无需鉴权。返回结果包含分页元数据与观测记录,便于获取范围明确的国家—时期面板。主要取舍是时效:许多发展指标为年度频率,并可能在采集和统一口径后较晚发布。

Before joining countries, inspect income-group aggregates, region codes, missing periods, and whether the indicator represents a modeled estimate or reported national value. Keep the indicator code in storage even if the interface displays a friendlier label.

连接不同国家数据之前,应检查收入组汇总、地区代码、缺失期间,以及指标属于模型估算还是各国上报值。即使界面展示了更友好的名称,存储时也应保留指标代码。

Use Eurostat or SDMX when dimensions are part of the question问题涉及多维统计时使用 Eurostat 或 SDMX

Eurostat is valuable when EU analysis requires detailed dimensions such as geography, age, sex, industry, unit, or seasonal adjustment. Its official API guidance supports JSON-stat, SDMX-CSV, SDMX-ML, and TSV, and distinguishes statistics, SDMX, and catalogue endpoints. Query the dataset structure before requesting observations: the position and code of each dimension determine how values should be decoded.

当欧盟分析需要地区、年龄、性别、行业、单位或季调等详细维度时,Eurostat 很有价值。其官方接口支持 JSON-stat、SDMX-CSV、SDMX-ML 和 TSV,并区分统计、SDMX 与目录接口。请求观测之前应先查询数据集结构,因为每个维度的位置与代码决定数值如何解码。

Prefer a narrow subset over a full multidimensional download. Large datasets can be slow and memory intensive, while a constrained query is easier to validate. DBnomics can help discover series across several institutions, but the underlying provider code and original metadata should remain visible downstream.

应优先请求较窄的子集,而不是直接下载完整多维数据集。大型数据集可能响应缓慢且占用大量内存,而约束明确的查询更容易验证。DBnomics 可以帮助跨机构发现序列,但下游仍应保留底层提供方代码和原始元数据。

Use aggregators for discovery, but keep the original institution and series identifier in storage. A provider may normalize labels or formats without changing the underlying statistical definition. When two APIs expose the same named indicator, compare source agency, series code, unit, frequency, seasonal adjustment, start date, and last update before assuming the values are interchangeable.

聚合平台适合发现数据,但存储时仍应保留原始机构与序列标识符。提供方可以标准化标签或格式,却不会自动统一统计定义。当两个 API 提供同名指标时,应比较来源机构、序列代码、单位、频率、季调、起始日期和最后更新时间,不能直接假设数值可以互换。

How to evaluate an economic data API correctly如何正确评估经济数据 API

A reliable evaluation uses a small, repeatable test pack instead of a feature checklist. Select one monthly series, one quarterly series, one revised series, one missing observation, and one cross-country indicator. Run the same tests against every candidate and save both metadata and raw responses.

可靠的评估不应只看功能清单,而应使用一套小规模、可重复的测试数据。选择一个月度序列、一个季度序列、一个会修订的序列、一个缺失观测,以及一个跨国指标,对所有候选 API 运行相同测试,并保存元数据与原始响应。

Definitions, units, and transformations定义、单位与转换方式

Confirm whether the response is a level, index, percentage, percentage-point change, annualized rate, year-over-year growth, or period-over-period growth. Do not calculate growth twice when the provider already returns a transformed series. If you transform observations yourself, preserve the raw value and document the formula, rounding, missing-value policy, and minimum history required.

确认返回值是绝对水平、指数、百分比、百分点变化、年化率、同比增速还是环比增速。当提供方已经返回转换后的序列时,不要再次计算增长率。自行转换时,要保留原始值,并记录公式、四舍五入方式、缺失值政策和最低历史长度。

Frequency, calendar, and seasonal adjustment频率、日历与季节调整

Daily, weekly, monthly, quarterly, and annual observations cannot be joined by date alone. Decide whether a date represents the start of a period, end of a period, reference month, release day, or provider update. Treat seasonally adjusted and not seasonally adjusted series as different datasets. When resampling, define aggregation rules explicitly rather than relying on a library default.

日度、周度、月度、季度和年度观测不能只靠日期直接连接。需要判断日期表示统计期开始、统计期结束、参考月份、发布日期,还是供应商更新时间。季调与非季调序列应视为不同数据集。重采样时必须明确聚合规则,不能完全依赖库的默认设置。

Revisions, vintages, and point-in-time use修订、历史版本与时点使用

Many economic observations are revised after their first release. GDP can be updated through several estimates; seasonal factors and benchmark weights can change historical values; surveys may be rebenchmarked. Store retrieval time and, when available, real-time period or vintage date. For backtests and event studies, query the observation that was available at the historical decision time.

许多经济数据在首次发布后还会修订。GDP 可能经历多轮估算,季节因子和基准权重可能改变历史值,调查数据也可能重新基准化。应存储获取时间,并在可用时保存实时期间或历史版本日期。回测和事件研究必须使用历史决策时点能够获得的观测。

Availability, limits, and failure handling可用性、限额与失败处理

Test pagination, maximum rows, timeout behavior, HTTP 429 responses, invalid series codes, empty date ranges, and provider maintenance. A production pipeline should distinguish “the observation is missing” from “the request failed.” Cache slow-changing metadata, retry temporary failures with backoff, and surface the last successful update rather than silently returning stale data.

测试分页、最大行数、超时、HTTP 429、无效序列代码、空日期范围和供应商维护状态。生产流程必须区分“该观测确实缺失”和“请求失败”。低频变化的元数据可以缓存,临时失败应退避重试,并明确展示最后一次成功更新时间,不能在没有提示的情况下返回过期数据。

Minimum metadata contract: provider, source institution, series ID, title, definition, geography, unit, frequency, seasonal adjustment, observation period, release or update timestamp, retrieval timestamp, and revision status.

最低元数据契约:提供方、来源机构、序列 ID、名称、定义、地区、单位、频率、季调状态、统计期、发布或更新时间、获取时间,以及修订状态。

How to use a macroeconomic data API in Python如何用 Python 获取宏观经济数据

A revision-aware workflow for GDP and inflation data APIs能够处理修订的 GDP 与 CPI 数据流程

1. Define the series precisely

Write down indicator, geography, unit, frequency, seasonal adjustment, price basis, and required history before choosing a provider.

2. Read metadata before observations

Resolve the provider’s indicator and country codes, then save the title, source, unit, frequency, and update notes with the series ID.

3. Request a small JSON sample

Use a narrow date range first. Confirm status, schema, null handling, pagination, ordering, and whether dates represent periods or publication timestamps.

4. Store provenance and revisions

Cache responsibly, retry transient failures, preserve raw responses, and record retrieval time. Do not overwrite earlier values when revision history matters.

1. 明确定义序列

选提供方前写清指标、地区、单位、频率、季调、价格口径与所需历史长度。

2. 先读取元数据

解析指标与国家代码,把标题、来源、单位、频率和更新说明与序列 ID 一起保存。

3. 先请求小范围 JSON

从较短日期范围开始,验证状态、字段结构、空值、分页、排序,以及日期代表统计期还是发布时间。

4. 保存出处与修订

合理缓存,只重试临时错误,保留原始响应并记录抓取时间;需要修订历史时不要直接覆盖旧值。

The World Bank Indicators API is a useful first integration because its official documentation says API keys are not required. This example requests US GDP, validates the two-part response structure, and keeps the indicator, country, unit, and retrieval metadata instead of returning an unexplained number.

世界银行指标 API 适合作为第一个接入示例,因为其官方文档明确说明无需 API Key。下面的代码请求美国 GDP,验证返回的两部分结构,并保留指标、国家、单位和获取元数据,而不是只返回一个无法解释的数字。

Python · requestsWorld Bank GDP example世界银行 GDP 示例
from datetime import datetime, timezone

import requests

url = "https://api.worldbank.org/v2/country/USA/indicator/NY.GDP.MKTP.CD"
params = {
    "format": "json",
    "date": "2018:2024",
    "per_page": 100,
}

response = requests.get(url, params=params, timeout=20)
response.raise_for_status()
payload = response.json()

if not isinstance(payload, list) or len(payload) != 2:
    raise ValueError("Unexpected World Bank response schema")

page_meta, observations = payload
clean = []
for row in observations or []:
    if row.get("value") is None:
        continue
    clean.append({
        "provider": "World Bank Indicators API",
        "indicator_id": row["indicator"]["id"],
        "indicator": row["indicator"]["value"],
        "country_id": row["countryiso3code"],
        "period": row["date"],
        "value": row["value"],
        "unit": "current US dollars",
        "retrieved_at": datetime.now(timezone.utc).isoformat(),
        "source_last_updated": page_meta.get("lastupdated"),
    })

print(clean[:2])

The unit in this example is tied to indicator code NY.GDP.MKTP.CD; do not reuse it for a different code. For a reusable pipeline, request indicator metadata separately, persist the raw payload, sort periods explicitly, and store a stable composite key such as provider + series ID + geography + period + vintage. Add schema tests before an update reaches a dashboard, model, or agent.

示例中的单位与指标代码 NY.GDP.MKTP.CD 绑定,不能直接用于其他代码。构建可复用流程时,应单独请求指标元数据,保存原始响应,明确排序统计期,并使用“提供方 + 序列 ID + 地区 + 统计期 + 历史版本”等稳定组合键。更新进入看板、模型或 Agent 之前,还应执行字段结构测试。

Common economic data API mistakes经济数据 API 的常见错误

Most analytical errors come from interpreting valid observations incorrectly, not from an API returning obviously broken JSON. Build checks around meaning as well as transport.

多数分析错误并不是 API 返回了明显损坏的 JSON,而是对有效观测作出了错误解释。检查流程既要覆盖传输,也要覆盖数据含义。

  • Mixing nominal and real values: current-price GDP and inflation-adjusted GDP answer different questions and cannot be compared without a stated price basis.
  • Confusing period with publication date: a value labeled “2024” may have been released or revised much later.
  • Ignoring seasonal adjustment: month-to-month comparisons can be misleading when one series is adjusted and another is not.
  • Creating look-ahead bias: today’s revised history contains information that was unavailable to a past decision-maker.
  • Joining on labels: country names and indicator titles change; use stable provider codes and preserve mappings.
  • Treating missing as zero: null, suppressed, unavailable, and genuine zero values must remain distinct.
  • 混用名义值和实际值:现价 GDP 与剔除通胀后的实际 GDP 回答不同问题,必须明确价格口径。
  • 混淆统计期和发布日期:标记为“2024”的数值,可能在更晚时间才发布或修订。
  • 忽略季节调整:当一个序列季调、另一个未季调时,月度变化可能产生误导。
  • 产生前视偏差:今天看到的修订历史,包含过去决策者当时无法获得的信息。
  • 用名称直接连接:国家名称和指标标题会变化,应使用稳定代码并保存映射。
  • 把缺失值当作零:空值、被抑制、不可用和真实零值必须保持区别。

For high-impact decisions, keep a link to the original release and validate critical values with the publishing institution. An aggregator or discovery layer can make access easier, but it does not replace the official definition, methodology, release notes, or revision policy.

对于影响较大的决策,应保留原始发布链接,并向发布机构核对关键数值。聚合服务或工具查找入口可以降低访问难度,但不能替代官方定义、方法说明、发布注释和修订政策。

How QVeris helps discover economic data APIsQVeris 如何帮助发现经济数据 API

QVeris does not change a provider’s data or promise broader coverage. It helps developers and agents search for relevant capabilities, inspect their documented inputs and outputs, and connect the chosen tool to a workflow. Start with the QVeris Tool Finder, then confirm provider documentation before production use.

QVeris 不会改变提供方的数据,也不承诺扩大覆盖范围。它帮助开发者和 Agent 查找相关能力、检查已记录的输入与输出,再把选定工具接入工作流。可以先从 QVeris 工具搜索开始,但在生产环境使用前,仍应核对提供方的官方文档。

  • Search by task and indicator instead of guessing a provider name.
  • Inspect authentication, required parameters, response shape, and documented limits.
  • Keep the original provider, series code, unit, and retrieval timestamp in downstream output.
  • 按任务与指标搜索,不必先猜测提供方名称。
  • 检查鉴权、必填参数、响应结构与已记录的调用限制。
  • 在下游结果中保留原始提供方、序列代码、单位与抓取时间。

FAQ常见问题

What is the best free API for macroeconomic data?

No single API wins every use case. FRED is strong for US time series, World Bank and IMF for international indicators, Eurostat for EU statistics, and DBnomics for cross-provider discovery.

Which macro data APIs work without an API key?

World Bank, IMF DataMapper, Eurostat, and DBnomics can be queried without a key. Recheck current policies, fair-use guidance, and limits before production deployment.

How do I get macroeconomic data in Python?

Use requests or a maintained client, begin with metadata and a small date range, validate units and dates, then add caching, retries, provenance, and revision-aware storage.

Does FRED have a free API?

Yes. FRED API access is free, while most requests require a free API key. See the dedicated free FRED data API guide.

Can I get economic data without an API key?

Yes. The World Bank Indicators API does not require authentication, and several other public statistical APIs can be queried without a key. Access rules, fair-use guidance, and endpoint behavior should still be checked before production use.

What is economic data revision?

A revision changes a previously published observation when more complete source data, updated seasonal factors, new weights, or benchmark information becomes available. Store retrieval or vintage dates when historical reproducibility matters.

How should an AI agent cite economic data?

Return the publishing institution, provider, series ID, indicator title, geography, unit, observation period, release or update date, and retrieval time with the value. Link to the official series or release when possible.

Can I combine FRED, World Bank, and Eurostat data?

Yes, but normalize country codes, dates, units, frequency, seasonal adjustment, and definitions first. Similar labels do not guarantee that two institutions measure the same concept in the same way.

哪里有免费的经济数据 API?

常见选择包括 FRED、世界银行、IMF DataMapper、Eurostat 与 DBnomics。应按地区、指标、频率和修订需求选择。

哪些经济数据接口无需 API 密钥?

世界银行、IMF DataMapper、Eurostat 和 DBnomics 可无需 Key 调用;生产部署前仍需复核当前政策与限制。

如何用 Python 获取宏观经济数据?

先获取元数据与小范围样本,验证单位、日期和空值,再加入缓存、重试、出处记录与修订处理。

FRED API 是否免费?

FRED API 免费,但多数请求需要免费 API Key。可阅读 免费 FRED 数据 API 指南

可以不用 API Key 获取经济数据吗?

可以。世界银行指标 API 不要求鉴权,其他一些公共统计接口也可直接查询。生产使用前仍应检查访问政策、合理使用说明和接口行为。

什么是经济数据修订?

当更完整的源数据、更新的季节因子、新权重或基准信息可用时,机构会修改已经发布的观测。需要历史可复现性时,应保存获取日期或历史版本日期。

AI Agent 应如何引用经济数据?

返回数值时应同时提供发布机构、提供方、序列 ID、指标名称、地区、单位、统计期、发布或更新时间与获取时间,并尽量链接到官方序列或发布页。

可以合并 FRED、世界银行和 Eurostat 数据吗?

可以,但必须先统一国家代码、日期、单位、频率、季调和定义。相似名称并不表示不同机构以相同方式衡量同一概念。

External references外部参考链接