Piotr VassevPiotr Vassev

How to Export DefiLlama Data for a DeFi Market Snapshot

A useful DeFi snapshot starts with one measurement and one population. Adding chain TVL, protocol TVL, trading volume, and stablecoin supply into a single total creates a number with no clear meaning.

The DefiLlama Scraper returns chain metrics and optional protocol, DEX, fee, and stablecoin records. I maintain it. This guide compares the top 25 chains by TVL and stores enough context to repeat that comparison later.

How to Export DefiLlama Data for a DeFi Market Snapshot

Keep the first snapshot to chains

The Actor runs on Apify and reads DefiLlama's public endpoints without a DefiLlama API key. Chain collection is always enabled. The four optional switches add separate datasets; they do not enrich only your selected chains.

Open Input in JSON view and enter:

{
  "maxChains": 25,
  "scrapeProtocols": false,
  "scrapeDexes": false,
  "scrapeFees": false,
  "scrapeStablecoins": false
}

maxChains selects up to that many top chains by TVL and accepts values from 1 to 1,000. It is not a cap on the entire run. Turning on scrapeProtocols can add roughly 4,000 protocol rows even when maxChains is 25.

Click Start, then open the dataset. Confirm that the first run contains type: "chain" records. Export JSON to preserve the original values, or CSV for the chain-only comparison.

Pricing as of September 6, 2026: $0.00025 per result, plus $0.00005 per GB of allocated memory at Actor start, minimum one event. Twenty-five chain rows cost $0.00625 in result fees. Optional families add their own rows at the result rate; they are not included within the 25-chain allowance. Check live pricing before enabling a large family.

Read the measures by record type

Record typeUseful fieldsWhat to compare
chainname, chainId, tvl, tvlChange7d, fees7dChain-level values at the collection time.
protocolslug, category, chains, tvlProtocols with comparable categories and scope.
dexslug, volume24h, volume7d, volume30dTrading volumes over matching windows.
feeslug, fees24h, fees7d, fees30dReported fees, without relabeling them revenue.
stablecoinsymbol, pegType, price, circulatingSupply and price within the relevant peg context.

All types share one dataset when enabled, but they do not share a meaning for every field. Filter by type before calculating totals or making a chart. The fee sample exposes fee fields; a general description mentioning revenue is not a reason to invent a returned revenue column.

DefiLlama dataset showing metrics by record type

Earlier DefiLlama output illustrates the dataset structure; these are not current market values.

Build a dated chain comparison

Keep name, chainId, tvl, tvlChange1d, tvlChange7d, tvlChange30d, and the available fee fields. Add your own collectedAt column from the run time: the documented output does not provide a universal scrape-timestamp field.

Sort numeric tvl values descending. Calculate each row's share of the collected chain total and label the denominator explicitly. For example, if a chain has 20 units of TVL and your selected sample totals 100, its share of that sample is 20%. It is not automatically 20% of all DeFi.

Keep missing values blank and display the count of chains with usable TVL or fee data. A missing fees7d should not make a chain appear to have zero activity. Compare the same time window across rows: seven-day fees and 24-hour fees are different quantities.

For a recurring report, store each export with the input configuration and run time. Match chain identities carefully, using chainId where available and a reviewed name mapping where it is not. The top-25 membership can change, so distinguish a newly included chain from growth in an existing chain.

Add protocols only for a separate question

Enable scrapeProtocols when you want to compare, for example, lending protocols. Filter the returned protocol rows by category and retain their chains arrays. A protocol's total TVL must not be copied in full to every chain listed in that array; that would count the same value repeatedly.

Do not add chain and protocol TVL together. They are overlapping levels of aggregation, not disjoint pots of funds. Similarly, a fee total is not protocol profit, and trading volume is not TVL. Preserve DefiLlama's measure names and methodological context rather than treating a high value as a recommendation.

If an optional family is missing, first check its switch and the run log. Endpoint availability can affect one family while others still return data. Save each family in its own table or sheet keyed by type and its identity field so a partial response cannot silently replace a complete earlier snapshot.

The Node.js example shows how to run this Actor from code and retrieve its dataset.

Frequently asked questions

Does maxChains cap optional protocol or DEX records?

No. maxChains limits chain rows only. Each optional switch adds its own record family, which can substantially increase the total row count.

Can I add chain and protocol TVL together?

No. Chain and protocol TVL are overlapping aggregation levels. Keep them in separate comparisons, and do not assign a multi-chain protocol’s full TVL to every chain in its chains array.

Piotr Vassev

Piotr Vassev

Founder of FalconScrape. Building production-grade web scraping systems and data automation pipelines for businesses worldwide.

Connect on LinkedIn