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
Capital basedefillama_capital_base1hTVL, stablecoin supply, and base capital levels
Capital flowsdefillama_capital_flows1hChain, protocol, and stablecoin flow changes
Economic throughputdefillama_economic_throughput1hDEX volume, fees, revenue, and open interest

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 capital base
/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.

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 Latest Data viewer and decision context resolver 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 to those relevant subjects before applying maxPoints. This prevents a broad chain/protocol snapshot from hiding older BTC-relevant rows behind unrelated rows. Protocol rows are stored for macro summaries and future enrichment, but they are not blindly attached to every asset.

Local Commands

bash
cd services/market-backend
npm run defillama:ingest
npm run defillama:ingest -- --dry-run