Choose a Free DeFi Data API
for TVL, Yields, and Protocol Metrics选择免费 DeFi 数据 API
获取 TVL、收益率与协议指标
Compare protocol and chain coverage, historical TVL, yields, fees, free-tier limits, and data quality before you integrate.
比较协议与多链覆盖、历史 TVL、收益率、费用、免费层限制和数据质量,
再决定如何接入。
TL;DR: what a free DeFi data API should provide核心结论:免费 DeFi 数据 API 应提供什么
TVL, pool APY, fees, revenue, volume, and wallet positions use different sources and definitions. Start with the output your application needs.
Separate a public no-key endpoint, an ongoing free tier, and a trial. Record authentication, quota, attribution, storage, and upgrade triggers.
Validate timestamps, units, chain and protocol identifiers, nulls, rate-limit responses, retries, caching, and a fallback before relying on the feed.
TVL、池 APY、费用、收入、交易量和钱包仓位来自不同数据源,也使用不同定义。先明确应用需要的输出。
区分无需 Key 的公共端点、长期免费层与限时试用,并记录鉴权、配额、署名、存储和升级触发条件。
依赖数据流前,应验证时间戳、单位、链与协议标识、空值、限流响应、重试、缓存与故障回退。
Define the DeFi protocol data API output先定义 DeFi 协议数据 API 的输出
TVL, historical TVL, and chain breakdownsTVL、历史 TVL 与分链数据
A free DeFi TVL API should identify the protocol, chain, timestamp, currency, and calculation scope. Historical series also need a documented interval and consistent treatment of borrowed assets, staking, pool2 assets, and double counting.
免费 DeFi TVL 数据接口应明确协议、链、时间戳、计价货币和计算范围。历史序列还需要说明时间粒度,并一致处理借入资产、质押、Pool2 资产和重复计算。
Yield, fees, revenue, and volume收益率、费用、收入与交易量
APY is not one universal field. Check whether base yield and token incentives are separated, how compounding is handled, and whether fees represent user-paid fees or protocol revenue. Keep raw values and provider definitions with derived metrics.
APY 并非统一字段。需要检查基础收益与代币激励是否分开、复利如何计算,以及费用代表用户支付费用还是协议收入。衍生指标应与原始值和服务商定义一起保存。
Protocol identifiers and multi-chain coverage协议标识与多链覆盖
Use stable IDs rather than display names. Confirm parent protocols, versions, forks, pools, tokens, native and bridged assets, and chain aliases before joining data across endpoints.
应使用稳定 ID,而不是仅依赖展示名称。跨端点关联前,应核对母协议、版本、分叉、池、代币、原生与跨链资产,以及链别名。
Minimum response schema最低响应字段规范
A usable response should expose a stable entity ID, human-readable name, chain, metric name, numeric value, unit or quote currency, source timestamp, and source or methodology reference. Historical endpoints also need interval, start and end boundaries, pagination, and an explicit empty-result behavior.
可用响应至少应包含稳定实体 ID、可读名称、链、指标名称、数值、单位或计价货币、源时间戳,以及数据来源或方法说明。历史端点还应明确时间粒度、起止边界、分页规则和空结果行为。
Methodology and revision policy指标口径与修订策略
Ask whether the provider recomputes history when token prices, protocol adapters, or classifications change. Store a retrieval timestamp and schema version so a later revision can be distinguished from an application bug.
需要确认代币价格、协议适配器或分类发生变化时,服务商是否会重算历史数据。保存采集时间和 Schema 版本,才能区分后续数据修订与应用自身故障。
Compare free DeFi data API options比较免费 DeFi 数据 API 选项
| Requirement要求 | Verify核验内容 | Why it matters重要性 |
|---|---|---|
| Coverage | Protocols, pools, chains, history协议、池、链、历史范围 | Prevents silent data gaps防止静默数据缺口 |
| Freshness | Source timestamp and update cadence源时间戳与更新频率 | Separates live views from research data区分实时视图与研究数据 |
| Free tier | Key, quota, burst limit, trial expiryKey、配额、突发限制、试用期限 | Determines usable capacity决定可用容量 |
| License | Display, storage, attribution, redistribution展示、存储、署名、再分发 | Technical access is not data permission技术访问不等于数据授权 |
| Reliability | Errors, status, changelog, fallback错误、状态、变更记录、回退 | Supports production operations支持生产运维 |
A useful shortlist must be testable against the same metric contract. Require every candidate to return the requested entity, chain, interval, quote currency, source time, and methodology fields; otherwise a convenient response can quietly change the question being measured.
有效的候选清单必须使用同一份指标契约进行测试。每个候选接口都应返回指定实体、链、时间区间、计价货币、源时间和方法字段;否则,一个看似方便的响应可能在不知不觉中改变原本要衡量的问题。
Run a representative acceptance test执行代表性验收测试
Test one large protocol, one small protocol, one multi-chain protocol, one pool with incentives, and one historical range that crosses a known migration or version change. Record missing fields, null handling, latency observed in your own test, quota headers, and whether repeated requests return consistent identifiers.
建议分别测试大型协议、小型协议、多链协议、包含激励的池,以及跨越迁移或版本变化的历史区间。记录缺失字段、空值处理、实际测试延迟、配额响应头,以及重复请求是否返回一致标识。
Do not compare on endpoint count alone. Ten well-documented endpoints with stable entities and timestamps can be more useful than hundreds of loosely defined fields.
不要只比较端点数量。十个实体与时间戳稳定、文档清晰的端点,可能比数百个定义模糊的字段更有价值。
Choose a source for historical DeFi data选择 DeFi 历史数据来源
Aggregated DeFi APIs聚合型 DeFi API
Aggregators normalize many protocols and chains behind REST or GraphQL. They are useful for dashboards and research, but you must inspect each metric methodology and update cadence.
聚合服务通过 REST 或 GraphQL 统一多个协议和链,适合仪表板与研究;但仍需逐项检查指标口径与更新频率。
Protocol APIs, subgraphs, and RPC data协议 API、Subgraph 与 RPC 数据
Protocol-native endpoints and subgraphs can expose more granular state. RPC and indexed blockchain data offer maximum control but require contract knowledge, decoding, reorg handling, backfills, and your own metric logic.
协议原生端点和 Subgraph 往往提供更细粒度状态。RPC 与索引后的链上数据控制力最高,但需要合约知识、解码、重组处理、回填和自定义指标逻辑。
Market-data and price dependencies市场价格数据依赖
USD-denominated TVL, fees, and revenue depend on a price source in addition to onchain balances. Verify the quote timestamp, venue or aggregation method, treatment of thin liquidity, and behavior when a token lacks a reliable price.
以美元计价的 TVL、费用和收入除了链上余额,还依赖价格来源。应核验价格时间戳、交易场所或聚合方法、低流动性处理方式,以及代币缺少可靠价格时的行为。
A practical hybrid architecture实用的混合数据架构
Many applications use an aggregator for discovery and normalized cross-protocol views, then verify high-value or risk-sensitive fields against protocol-native or indexed onchain data. This reduces integration work without treating one source as unquestionable truth.
不少应用会先用聚合服务完成发现和跨协议标准化,再用协议原生或索引后的链上数据核验高价值、风险敏感字段。这样既能降低接入成本,也不会把单一来源当作不可质疑的事实。
Prioritize normalized IDs, consistent history, cacheability, and clear update timestamps.
优先考虑统一 ID、连续历史、可缓存性和明确的更新时间戳。
Prioritize methodology, revisions, bulk history, reproducibility, and source attribution.
优先考虑指标方法、历史修订、批量历史、可复现性和来源归因。
Prioritize typed schemas, bounded outputs, explicit errors, freshness fields, and safe retry behavior.
优先考虑类型明确的 Schema、受控输出、显式错误、新鲜度字段和安全重试行为。
Validate DeFi TVL, yield, and historical series with worked examples通过实例验证 DeFi TVL、收益率与历史序列
TVL example: one deposit can appear in several protocolsTVL 示例:同一笔资金可能出现在多个协议中
Suppose a user deposits 100 million USD of an asset into a lending protocol, borrows 60 million of a stablecoin, and deposits that stablecoin into a yield vault. A simple sum reports 160 million across the two protocols even though only 100 million of outside capital entered the system. If the vault then supplies the stablecoin back to the same lending market, another aggregation layer can count part of it again.
假设用户把价值 1 亿美元的资产存入借贷协议,借出 6000 万美元稳定币,再把这笔稳定币存入收益金库。简单相加会把两个协议的 TVL 报告为 1.6 亿美元,但进入系统的外部资本只有 1 亿美元。如果收益金库又把稳定币存回同一个借贷市场,下一层聚合还可能再次计算其中一部分。
Neither number is automatically wrong: protocol TVL can describe assets controlled by each application, while ecosystem TVL may aim to measure unique capital. Store the scope explicitly—such as gross protocol assets, net deposits, borrowed assets included or excluded, pool2 included or excluded, and chain-level deduplication policy. Never compare two totals that use different scopes without labeling the difference.
这两个数字不一定谁对谁错:协议 TVL 可以描述各应用控制的资产,而生态系统 TVL 可能希望衡量独立资本。应明确保存口径,例如协议总资产、净存款、是否包含借出资产、是否包含 Pool2,以及链级去重策略。口径不同的总量不能在没有标注的情况下直接比较。
Yield example: separate base return from token incentives收益示例:区分基础收益与代币激励
Assume a pool earns a 4.2% base APY from borrower interest and advertises another 8.0% reward APY paid in a governance token. Reporting 12.2% as one stable return hides four assumptions: reward-token price, emission schedule, pool TVL, and whether rewards are sold and reinvested. If the reward token falls 50% while emissions and TVL stay constant, the reward component can fall near 4.0% even before slippage and claim costs.
假设某池通过借款利息获得 4.2% 的基础 APY,同时以治理代币发放 8.0% 的激励 APY。直接把两者合并成 12.2% 的稳定收益,会隐藏四项假设:激励代币价格、释放计划、池内 TVL,以及奖励是否能够卖出并复投。如果代币价格下跌 50%,而释放量和 TVL 不变,激励部分可能降至约 4.0%,这还没有考虑滑点和领取成本。
Keep baseApy, rewardApy, reward token, price timestamp, compounding convention, and observation window as separate fields. For comparison, show the unboosted base rate first, then add incentives with a warning when emissions are temporary, illiquid, vested, or unavailable to every depositor.
应分别保存 baseApy、rewardApy、激励代币、价格时间戳、复投约定和观察窗口。比较时先展示未加成的基础收益,再单独加入激励;若释放是临时的、流动性不足、需要归属期,或并非所有存款人都能获得,必须明确提示。
Historical discontinuities are not always capital flows历史序列断点不一定代表真实资金流
A version upgrade may move balances from v1 to v2. A parent-protocol series can stay continuous while version-level series show an outflow and inflow.
A provider may add a missing chain, exclude borrowed assets, or reclassify pool2. Historical TVL can jump even if no onchain transfer occurred.
A new price source or corrected decimals can rewrite USD history while token balances remain unchanged. Preserve both token amounts and quoted values when possible.
版本升级可能把余额从 v1 移至 v2。协议总序列可以保持连续,但版本序列会分别显示流出与流入。
服务商可能补充遗漏链、排除借出资产或重新分类 Pool2。即使链上没有发生转账,历史 TVL 也可能跳变。
更换价格源或修正小数位会重写美元历史,而代币余额并未变化。条件允许时,应同时保留代币数量和计价后的数值。
For every discontinuity, compare raw token balances, protocol events, provider changelogs, adapter versions, and retrieval dates before labeling it an inflow or outflow. A reproducible history needs both the observation date and the date on which that historical value was retrieved.
遇到序列断点时,应先对照原始代币余额、协议事件、服务商更新日志、适配器版本和获取日期,再判断它是否是真实资金流。可复现的历史数据既要保存观测日期,也要保存该历史值实际被获取的日期。
Integrate a free DeFi API for developers开发者如何接入免费 DeFi API
1. Write a small data contract1. 编写小型数据契约
Specify metric, protocol or pool ID, chain, time interval, quote currency, maximum staleness, and required fields. This prevents a convenient endpoint from redefining the product requirement.
明确指标、协议或池 ID、链、时间区间、计价货币、最大陈旧时间和必需字段,避免方便的端点反过来改变产品需求。
2. Test one representative JSON response2. 测试一条代表性 JSON 响应
GET /protocol/{slug}
Accept: application/json
validate: id, chain, timestamp, tvlUsd
reject: stale timestamps, unknown units, impossible values
3. Add quota-aware caching and retries3. 添加配额感知缓存与重试
Cache by the metric’s actual freshness need. Treat 400-series validation errors, 429 limits, and 500-series provider failures separately. Retry only safe requests with bounded exponential backoff and jitter.
按指标真实的新鲜度需求缓存。分别处理 400 系列参数错误、429 限流和 500 系列服务商故障;只对安全请求使用有上限、带抖动的指数退避。
4. Backfill history without creating gaps4. 回填历史数据且避免缺口
Persist the requested time window, returned boundaries, page cursor, record count, and completion state for every batch. Use idempotent writes keyed by entity, metric, chain, and timestamp so a retry cannot duplicate rows.
每个批次都应保存请求时间窗、实际返回边界、分页游标、记录数和完成状态。以实体、指标、链和时间戳作为幂等写入键,避免重试造成重复数据。
5. Version the adapter and raw payload5. 对适配器与原始响应进行版本管理
Keep the original response or a traceable sample before normalization. Version field mappings and transformations, then run contract tests when the provider publishes a changelog or an unexpected field appears.
标准化前应保留原始响应或可追踪样本,并对字段映射与转换逻辑进行版本管理。当服务商发布变更记录或出现意外字段时,运行契约测试。
Production checklist for a multi-chain DeFi data API多链 DeFi 数据 API 生产检查清单
Data quality and freshness数据质量与新鲜度
- Store source and ingestion timestamps separately.
- Validate units, decimals, currency, chain, protocol, pool, and token IDs.
- Monitor missing protocols, discontinuities, null spikes, and revision behavior.
- Compare critical metrics with a protocol-native or independent source.
- 分别保存源时间戳与采集时间戳。
- 验证单位、小数位、货币、链、协议、池和代币 ID。
- 监控协议缺失、序列中断、空值激增和数据修订。
- 关键指标应与协议原生或独立来源交叉核对。
Security and operations安全与运维
Keep API keys server-side, set explicit timeouts and response-size limits, pin expected schemas, log provider request IDs, and alert before quota exhaustion. A free endpoint can be useful in production only when its license, availability, capacity, monitoring, and fallback meet your risk tolerance.
API Key 应保存在服务端,并设置超时与响应大小限制、固定预期 Schema、记录服务商请求 ID、在配额耗尽前告警。只有许可、可用性、容量、监控和回退满足风险要求时,免费端点才适合生产环境。
Use QVeris to find free DeFi data API capabilities用 QVeris 查找免费 DeFi 数据 API 能力
Describe the required output in QVeris tool details—for example historical protocol TVL, yield pools, or fees and revenue—then inspect candidate input and output schemas before making a call.
在 QVeris 工具详情中描述所需输出,例如协议历史 TVL、收益池或费用与收入,再在调用前检查候选能力的输入输出 Schema。
Use the Capability Map to explore related tools and the QVeris documentation for integration guidance. QVeris helps with capability discovery and inspection; provider limits, licenses, and metric methodology still require verification in official documentation.
可使用能力地图探索相关工具,并查阅 QVeris 文档了解接入方式。QVeris 帮助发现和检查能力;服务商限制、许可与指标口径仍需在官方文档中核验。
Free DeFi data API FAQ免费 DeFi 数据 API 常见问题
Is there a free API for DeFi data?
Yes. Public endpoints and free tiers can provide TVL, yields, fees, revenue, volumes, and protocol metadata. Coverage and usage rights vary.
How do I get DeFi TVL data?
Use an aggregator or protocol-native endpoint with protocol IDs, chain breakdowns, timestamps, currency, and a documented TVL methodology.
Does DeFiLlama have a free API?
DeFiLlama publishes public API documentation for several datasets. Confirm the current endpoint, terms, and limits in its official documentation before integration.
Which API provides DeFi yield data?
Aggregators and protocol APIs expose pool rates. Compare base APY, reward APY, TVL, asset, chain, timestamps, and compounding definitions.
Can I use a free DeFi API in production?
Only after its license, availability, quota, change policy, monitoring, and fallback meet the application’s requirements.
What should I compare in a DeFi data API?
Compare metric definitions, protocol and chain coverage, history, freshness, authentication, limits, license, errors, and operational support.
有免费的 DeFi 数据 API 吗?
有。公共端点与免费层可提供 TVL、收益率、费用、收入、交易量和协议元数据,但覆盖与使用权利不同。
如何获取 DeFi TVL 数据?
选择提供协议 ID、分链数据、时间戳、计价货币和明确 TVL 方法的聚合或协议原生端点。
DeFiLlama API 免费吗?
DeFiLlama 为多个数据集发布公共 API 文档;接入前应在官方文档核验当前端点、条款和限制。
哪里可以获取 DeFi 收益率数据?
聚合服务与协议 API 可返回池利率,应比较基础 APY、奖励 APY、TVL、资产、链、时间戳与复利定义。
免费 DeFi API 能用于生产环境吗?
只有许可、可用性、配额、变更策略、监控和回退都满足应用要求时才适合。
比较 DeFi 数据 API 时看什么?
比较指标定义、协议与链覆盖、历史范围、新鲜度、鉴权、限制、许可、错误处理和运维支持。
