docs

DeFi Llama Node

The DeFi Llama node pulls DeFi analytics into your workflow — Total Value Locked (TVL) for protocols and chains, pool yields and APY rates, stablecoin supply, DEX volumes, and protocol fee/revenue data. Use it to monitor protocol health, optimize yield strategies, generate TVL-based trading signals, or build dashboards over the broader DeFi ecosystem. The data comes from DeFi Llama, a free public API that requires no API key.

Aave TVL
Protocol TVL

Configuration

General

Give this node a custom name to identify it in your workflow

Continue workflow if this node fails

DeFi Llama

Free DeFi data — no API key required

Type of DeFi data to fetch

Protocol slug from defillama.com (e.g. aave, uniswap, lido)

Chain name (e.g. ethereum, arbitrum, polygon, base)

Time & Data

Configure time range and result size

Max number of results returned (1–500)


Why DeFi Data Matters

On-chain DeFi metrics tell you what is actually happening with capital, not just what prices say. Each query type unlocks a different layer:

  • Protocol TVL measures the dollar value locked in a single protocol over time. Sharp inflows often precede price moves; sharp outflows can signal a loss of confidence or a security incident.
  • Chain TVL shows the total liquidity hosted on a blockchain. Comparing chain TVL trajectories surfaces which ecosystems are gaining or losing share.
  • Yields / APY lists every tracked liquidity pool with its current APY, base yield, reward yield, and TVL. Useful for yield optimization and ranking opportunities by risk.
  • Stablecoins tracks circulating supply by issuer (USDT, USDC, DAI, etc.). Supply expansion is a leading indicator of capital entering crypto.
  • DEX Volumes ranks decentralized exchanges by trading volume across multiple windows (24h, 7d, 30d, all-time).
  • Fees & Revenue measures protocol monetization. A protocol generating real fees is fundamentally healthier than one subsidized purely by token emissions.

Feed this data into an LLM or Function node to build workflows that react to fundamentals rather than just price action.


Configuration

FieldDescription
Query TypeWhich DeFi Llama dataset to fetch (see table below). Default: Protocol TVL.
ProtocolThe DeFi Llama protocol slug (e.g. aave, uniswap, lido). Required for Protocol TVL; optional filter for Yields. Find slugs at defillama.com/protocols. Supports {edgeLabel.field} interpolation via the f(x) toggle.
ChainThe chain name (e.g. ethereum, arbitrum, polygon, base). Required for Chain TVL; optional filter for Yields, DEX Volumes, and Fees & Revenue. Supports the f(x) toggle for dynamic values.
Time RangeHistorical window for time-series data: 7d, 30d (default), 90d, 180d, 365d, or all time. Only applies to Protocol TVL and Chain TVL.
Data Points LimitMaximum number of results to return. Range: 1–500. Default: 100.

Query Types

Query TypeDescriptionProtocol FieldChain Field
Protocol TVLHistorical TVL and metadata for one protocolRequired
Chain TVLHistorical TVL for one blockchainRequired
Yields / APYAll tracked liquidity pools with APY dataOptional filterOptional filter
StablecoinsStablecoin issuers ranked by circulating supply
DEX VolumesDecentralized exchanges ranked by volumeOptional filter
Fees & RevenueProtocols ranked by fees / revenueOptional filter

Finding the Right Slug

Protocol slugs are not always obvious — DeFi Llama uses lowercased, hyphenated identifiers. Some examples:

  • Aave → aave
  • Uniswap → uniswap
  • Lido → lido
  • Pendle → pendle
  • Curve Finance → curve-dex
  • PancakeSwap AMM → pancakeswap-amm

Browse the full list at defillama.com/protocols and copy the slug from the protocol's URL.

Dynamic Protocol & Chain Values

Toggle the f(x) button next to the Protocol or Chain field to use a value from an upstream node. For example, you can iterate over a list of protocols with a Loop node:

{loop.item}

This is useful for batch-monitoring multiple protocols or chains in a single workflow.


Workflow Examples

Protocol Health Monitor

Track a protocol's TVL and alert when it drops sharply — often a leading signal of a security incident, a contagion event, or a loss of user confidence.

Aave TVL
Protocol TVL
TVL Drop %
JavaScript
Drop > 10%?
1 rule
Alert

The Function node computes the percentage change between the most recent TVL data point and a baseline (e.g. 7 days ago). The Conditional node triggers a Telegram alert if the drop exceeds your threshold.

Yield Optimization

Find the highest-yielding stablecoin pools on a specific chain and let an LLM rank them by risk-adjusted return.

Arbitrum Yields
Yields / APY
Filter Stables
JavaScript
Rank by Risk
Claude Sonnet 4.6
Daily Digest

Set the DeFi Llama node's chain filter to arbitrum. The Function node keeps only pools where stablecoin: true. The LLM compares APY against TVL, audit history, and pool composition to suggest the best opportunities, and the Email node sends the digest.

TVL-Based Trading Signal

Use chain TVL momentum as a directional bias for trades on that ecosystem's native token.

Solana TVL
Chain TVL
SOL Price
Divergence?
Claude Sonnet 4.6
Bullish?
1 rule
Buy SOL

The DeFi Llama node and Price Data node both feed the LLM. The LLM looks for divergences — for example, rising chain TVL with stagnant price often precedes a catch-up rally. The Conditional node routes the decision to the Exchange node.


Pricing & Credits

Each DeFi Llama API call costs a flat 5 credits, regardless of query type, time range, or data points returned.


Output

The DeFi Llama node outputs a structured object with the fetched data and metadata. The shape of the data field varies by query type.

PathDescription
{defillama.queryType}The query type that was executed (e.g. protocolTvl)
{defillama.protocol}The resolved protocol slug, if applicable
{defillama.chain}The resolved chain name, if applicable
{defillama.timestamp}Unix timestamp of the query
{defillama.data}The fetched data — structure depends on query type (see below)
{defillama.metadata.source}Always defillama
{defillama.metadata.endpoint}The DeFi Llama endpoint that was called
{defillama.metadata.requestedAt}ISO timestamp of when the request was made
{defillama.metadata.dataPoints}Number of data points returned after filtering
{defillama.metadata.creditsUsed}Credits charged for this call

Data Shapes

  • Protocol TVLdata.tvl is an array of { date, totalLiquidityUSD } points; data.chainTvls is the same series broken down per chain. Other fields include name, symbol, category, chains, mcap, and currentChainTvls.
  • Chain TVLdata.history is an array of { date, tvl } points and data.chain echoes the queried chain.
  • Yieldsdata.pools is an array of pools (each with pool, project, chain, symbol, tvlUsd, apy, apyBase, apyReward, apyPct1D, apyPct7D, apyPct30D, stablecoin, ilRisk, exposure). data.totalMatched is the total count before the limit was applied.
  • Stablecoinsdata.stablecoins is an array of issuers with name, symbol, pegType, pegMechanism, price, and circulating supply at multiple time horizons.
  • DEX Volumes / Fees & Revenuedata.protocols is an array ranked by 24h volume/fees, each with name, chains, total24h, total7d, total30d, total1y, totalAllTime, and percentage change fields. data.total24h, data.total7d, data.total30d are the aggregate market totals.

Example Output (Protocol TVL)

{
  "queryType": "protocolTvl",
  "protocol": "aave",
  "timestamp": 1710835200,
  "data": {
    "name": "Aave",
    "symbol": "AAVE",
    "category": "Lending",
    "chains": ["Ethereum", "Arbitrum", "Polygon", "Avalanche"],
    "mcap": 1450000000,
    "currentChainTvls": {
      "Ethereum": 19600000000,
      "Arbitrum": 750000000
    },
    "tvl": [
      { "date": 1710748800, "totalLiquidityUSD": 21200000000 },
      { "date": 1710835200, "totalLiquidityUSD": 21450000000 }
    ],
    "chainTvls": {
      "Ethereum": [
        { "date": 1710748800, "totalLiquidityUSD": 19500000000 }
      ]
    }
  },
  "metadata": {
    "source": "defillama",
    "endpoint": "/protocol/aave",
    "requestedAt": "2026-04-10T11:46:38Z",
    "dataPoints": 30,
    "creditsUsed": 5
  }
}

For other query types, inspect the raw shape with a Function node and console.log(inputs) if you need to parse specific fields.


Common Errors

ErrorCauseFix
Resource not found at DeFi Llama (404)Wrong protocol slug or chain nameLook up the exact slug at defillama.com/protocols — values are lowercase and case-sensitive
DeFi Llama rate limit exceededToo many calls in a short windowDeFi Llama's public API has generous limits but is not unlimited — space requests out, or run the workflow on a longer schedule
DeFi Llama request timed outSlow upstream response or large payloadReduce the data points limit, or retry — the API is normally fast
Protocol slug is requiredQuery type is Protocol TVL but the Protocol field is emptySet a protocol slug, or switch to a query type that doesn't need one
Chain name is requiredQuery type is Chain TVL but the Chain field is emptySet a chain name, or switch to a different query type

Next Steps

  • LLM Node — Feed DeFi metrics into an LLM to generate analysis, rankings, or trade recommendations.
  • Function Node — Parse, transform, or aggregate raw DeFi Llama data with custom JavaScript.
  • Conditional Node — Route decisions based on TVL thresholds, APY ranges, or volume changes.
  • Price Data Node — Combine on-chain TVL with spot price for divergence analysis.
  • Loop Node — Iterate over a list of protocols or chains and aggregate the results.