Skip to content

DefiLlama Data Source

DefiLlama provides macro and DeFi regime context. It is not intended to map cleanly to every Hyperliquid asset.

Use it as a broad market state layer for capital, flows, and economic activity.

DefiLlama ingestion flow

What We Store

ChannelTableCadencePurpose
TVL, stablecoin supply, and base capital levelsdefillama_capital_base1hMacro base capital context
Chain, protocol, and stablecoin flow changesdefillama_capital_flows1hMacro flow context
DEX volume, fees, revenue, and open interestdefillama_economic_throughput1hMacro throughput context

Snapshot Model

The ingestor fetches broad snapshots from the free DefiLlama APIs:

text
chains
protocols
stablecoins
dex overview
fees overview
revenue overview
open interest overview
  -> compact global/chain/protocol/stablecoin rows

The rows are stored by subject:

Subject typeExample
globaldefi
chainEthereum, Solana, Arbitrum
protocoluniswap, aave, jupiter
stablecoinUSDC, USDT, DAI

How We Fetch Data

Configured endpoints:

ConfigDefault
DEFILLAMA_API_URLhttps://api.llama.fi
DEFILLAMA_STABLECOINS_URLhttps://stablecoins.llama.fi

The ingestor uses HTTP GET requests:

RequestBase URLUsed for
/v2/chainsDEFILLAMA_API_URLChain TVL and chain-level base capital
/protocolsDEFILLAMA_API_URLProtocol TVL, category, chain coverage, 1d/7d changes
/stablecoinsDEFILLAMA_STABLECOINS_URLStablecoin supply and chain-level stablecoin flows
/overview/dexs?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=dailyVolumeDEFILLAMA_API_URLDEX volume
/overview/fees?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=dailyFeesDEFILLAMA_API_URLFees
/overview/fees?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=dailyRevenueDEFILLAMA_API_URLRevenue
/overview/open-interest?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=trueDEFILLAMA_API_URLOpen interest

The worker waits DEFILLAMA_REQUEST_DELAY_MS between snapshot requests. The client has a 15-second default timeout, retries 429 and 5xx responses, and defaults to two retries.

The broad DefiLlama endpoints already return all chains, thousands of protocols, and hundreds of stablecoins in a small number of requests. Storage caps control how much of each broad snapshot is retained in hourly feature rows; they do not change the upstream request count.

Default storage caps:

ConfigDefaultApplies to
DEFILLAMA_TOP_PROTOCOL_LIMIT1000Protocol rows in capital_base and capital_flows
DEFILLAMA_TOP_STABLECOIN_LIMIT300Stablecoin rows in capital_base and capital_flows
DEFILLAMA_TOP_THROUGHPUT_PROTOCOL_LIMIT500Protocol rows in economic_throughput

Fetched snapshots are compacted into:

  • defillama_capital_base
  • defillama_capital_flows
  • defillama_economic_throughput

Trading Context

Trading prompts can use DefiLlama context to answer:

  • Is DeFi liquidity expanding or contracting?
  • Are stablecoins flowing into or out of the market?
  • Are fees, revenue, DEX volume, or open interest confirming risk appetite?
  • Which chains or protocols are showing unusually strong/weak activity?

This data should influence asset decisions as macro context. It should not be treated as a direct per-asset feed for every Hyperliquid symbol.

Context Resolver Behavior

When an asset has a connected DefiLlama Data Stream Block, the block should be configured with a channel and a macro scope:

  • global
  • chain
  • protocol
  • stablecoin

For explicit scopes, source links should point at the configured DefiLlama subject where possible, and the decision context resolver reads only that configured subject, such as Solana, aave, or USDC.

Legacy DefiLlama Data Stream Blocks without an explicit scope still return asset-relevant macro rows from the configured lookback window:

  • Global defi rows for the selected DefiLlama channel.
  • Chain rows when metrics.tokenSymbol matches the asset symbol, such as Bitcoin for BTC.
  • Stablecoin rows when the DefiLlama stablecoin subject matches the asset symbol, such as USDC.

The resolver filters before applying maxPoints. This prevents a broad chain/protocol snapshot from hiding older relevant rows behind unrelated rows.

Local Commands

bash
cd backend
npm run defillama:ingest
npm run defillama:ingest -- --dry-run