defillama

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

DeFiLlama API

DeFiLlama API

Query DeFi protocol TVL, yield farming opportunities, chain analytics, and stablecoin data via the free DeFiLlama API.
通过免费的DeFiLlama API查询DeFi协议的TVL、收益挖矿机会、链上分析以及稳定币数据。

Base URLs

基础URL

  • TVL & Protocols:
    https://api.llama.fi
  • Yields:
    https://yields.llama.fi
  • Stablecoins:
    https://stablecoins.llama.fi
  • Coins (prices):
    https://coins.llama.fi
No API key required. No strict rate limits, but be respectful.
  • TVL与协议
    https://api.llama.fi
  • 收益
    https://yields.llama.fi
  • 稳定币
    https://stablecoins.llama.fi
  • 代币(价格)
    https://coins.llama.fi
无需API密钥。没有严格的速率限制,但请合理调用。

Endpoints

接口端点

Protocol List

协议列表

GET https://api.llama.fi/v2/protocols
Returns all tracked protocols with current TVL, chain breakdown, category, and URL. Large payload — always filter or limit output to top N results.
GET https://api.llama.fi/v2/protocols
返回所有被追踪的协议,包含当前TVL、链上分布、分类以及URL。返回数据量较大——请务必过滤结果或限制为前N条结果。

Protocol TVL History

协议TVL历史数据

GET https://api.llama.fi/v2/tvl/{protocol}
  • protocol
    : slug from protocols list (see table below)
  • Returns daily TVL data points
GET https://api.llama.fi/v2/tvl/{protocol}
  • protocol
    :协议列表中的slug(见下表)
  • 返回每日TVL数据点

Protocol Detail

协议详情

GET https://api.llama.fi/protocol/{protocol}
Returns full protocol info: TVL per chain, token breakdown, governance token, audits.
GET https://api.llama.fi/protocol/{protocol}
返回协议完整信息:各链TVL、代币分布、治理代币、审计情况。

Chain TVL

链上TVL

GET https://api.llama.fi/v2/chains
Returns TVL for every tracked chain. Useful for chain comparison.
GET https://api.llama.fi/v2/chains
返回所有被追踪链的TVL数据,适用于链间对比。

Yield Pools

收益矿池

GET https://yields.llama.fi/pools
Returns all tracked yield pools. Very large payload — always filter by chain or project in your output.
Useful fields per pool:
chain
,
project
,
symbol
,
tvlUsd
,
apy
,
apyBase
,
apyReward
,
stablecoin
.
GET https://yields.llama.fi/pools
返回所有被追踪的收益矿池。返回数据量极大——请务必在输出中按链或项目过滤。
矿池常用字段:
chain
project
symbol
tvlUsd
apy
apyBase
apyReward
stablecoin

Stablecoins

稳定币

GET https://stablecoins.llama.fi/stablecoins?includePrices=true
Returns all stablecoins with circulating supply, peg data, and chain breakdown.
GET https://stablecoins.llama.fi/stablecoins?includePrices=true
返回所有稳定币的流通供应量、锚定数据以及链上分布。

Token Prices

代币价格

GET https://coins.llama.fi/prices/current/{coins}
  • coins
    : comma-separated in format
    {chain}:{address}
    (e.g.,
    bsc:0x0E09...
    )
  • Chain keys:
    bsc
    ,
    ethereum
    ,
    polygon
    ,
    arbitrum
    ,
    optimism
    ,
    base
GET https://coins.llama.fi/prices/current/{coins}
  • coins
    :以逗号分隔,格式为
    {chain}:{address}
    (例如:
    bsc:0x0E09...
  • 链标识:
    bsc
    ethereum
    polygon
    arbitrum
    optimism
    base

Common Protocol Slugs

常见协议Slug

ProtocolSlug
PancakeSwappancakeswap
Uniswapuniswap
Aave V3aave-v3
Lidolido
Curvecurve-finance
MakerDAOmakerdao
Compoundcompound-finance
GMXgmx
Convexconvex-finance
Rocket Poolrocket-pool
Venusvenus
Alpaca Financealpaca-finance
Biswapbiswap
Radiantradiant-v2
协议名称Slug
PancakeSwappancakeswap
Uniswapuniswap
Aave V3aave-v3
Lidolido
Curvecurve-finance
MakerDAOmakerdao
Compoundcompound-finance
GMXgmx
Convexconvex-finance
Rocket Poolrocket-pool
Venusvenus
Alpaca Financealpaca-finance
Biswapbiswap
Radiantradiant-v2

Usage Notes

使用注意事项

  • Large payloads: The
    /v2/protocols
    and
    /pools
    endpoints return massive JSON arrays. Always extract and present only the top N items relevant to the user's query.
  • Combine with CoinGecko for token price context and with
    read_contract
    for on-chain verification of TVL claims.
  • When presenting yield data, always note that APY is historical and not guaranteed.
  • Sort pools by TVL to surface safer opportunities first.
  • 大体积返回数据
    /v2/protocols
    /pools
    端点会返回非常大的JSON数组。请务必仅提取并展示与用户查询相关的前N项内容。
  • 可结合CoinGecko获取代币价格背景信息,或结合
    read_contract
    对TVL声明进行链上验证。
  • 展示收益数据时,请务必注明APY为历史数据,不代表未来收益保证。
  • 可按TVL对矿池排序,优先展示更安全的机会。

Example Queries

示例查询

User: "What's the TVL of PancakeSwap?" → Fetch
https://api.llama.fi/v2/tvl/pancakeswap
, report latest TVL
User: "Top yield pools on BSC" → Fetch
/pools
, filter
chain === "BSC"
, sort by
tvlUsd
desc, show top 10 with APY
User: "Compare TVL across chains" → Fetch
/v2/chains
, sort by
tvl
desc, present top 10
用户:"PancakeSwap的TVL是多少?" → 调用
https://api.llama.fi/v2/tvl/pancakeswap
,返回最新TVL数据
用户:"BSC上的顶级收益矿池" → 调用
/pools
,过滤
chain === "BSC"
,按
tvlUsd
降序排序,展示前10个带APY的矿池
用户:"对比各链的TVL" → 调用
/v2/chains
,按
tvl
降序排序,展示前10条链