Finance5 min readBy Purrkey team

How to track a blockchain's daily TVL history on DefiLlama

Pull a blockchain's daily TVL points for a chosen window and turn them into a dated table for trend checks

On this page

You have a treasury review coming and need Ethereum's daily total value locked for the last 90 days next to one peer chain over the same window, as a dated table you can scan for the week a drawdown started

defillama.chain.tvl_history returns that series one chain at a time. The contract describes it as "Daily total value locked of one blockchain over the most recent days." Two chains means two calls, and the table below is the deliverable. No run has been executed for this guide, so the values shown are a design, not a result

The deliverable table

One row per chain per day. Four columns: chain, date, tvlUsd and a day-over-day change. Values here are placeholders showing the shape

chaindatetvlUsdday-over-day change
Ethereuminteger copied from datenumber copied from tvlUsdempty on the first point
Ethereuminteger copied from datenumber copied from tvlUsdcurrent tvlUsd minus the previous row's tvlUsd
Peer chaininteger copied from datenumber copied from tvlUsdcurrent tvlUsd minus the previous row's tvlUsd

Two of those columns come straight from the response and two do not. The day-over-day change is your arithmetic. The tool has no field for it, and a series that starts mid-drawdown will show a large first reading only because the earlier point is outside the window. Sort the rows by chain, then by date, before subtracting, or the column will mix two series together

Input: a chain name and a window

The contract lists chain and days. chain is required, is a string, and matches the pattern ^[A-Za-z0-9][A-Za-z0-9 ._-]{0,63}$, so letters, digits, spaces, dots, underscores and hyphens are fine up to 64 characters. The brief describes it as the blockchain name accepted by DefiLlama, such as Ethereum

days is an integer with a minimum of 1 and a maximum of 365, and it defaults to 30. That default is the limit to watch at this step: a request without days returns 30 points, not 90. There is no input that reaches past 365 days in a single call, so a three-year chart cannot be built from one request to this tool

Example input, with the chain taken from the brief and the day count chosen for the review:

json
{
  "chain": "Ethereum",
  "days": 90
}

Swap in whichever chain name your own review covers for the second call

Reading the output fields

The response is an object with chain and points. chain echoes the name you sent, which is how you keep two responses apart when you run them in sequence. points is an array capped at 365 items, and each item has a date integer and a tvlUsd number

Check points length first. A 90-day request that comes back with fewer points tells you the series is short before you spend time on percentages. Then check the date values against your window, because the contract does not say the points are contiguous or that they cover each calendar day in the range. A gap will distort a day-over-day column without any error being raised

The contract does not describe how date is encoded either. Read one response by hand before you write a formatter

tvlUsd is the number the treasury conversation turns on. Plot it as a line per chain, and let the day-over-day change carry the question of when value started leaving

The agent prompt

Agent prompt
Set up https://purrkey.app/SKILL.md, then use Purrkey to pull daily TVL
history for Ethereum and one peer chain over the last 90 days. Check the
current inputs and price of defillama.chain.tvl_history before running
anything. Call the tool once per chain with days set to 90. Return a
table with chain, date, tvlUsd and a day-over-day change column, where
the change is the current tvlUsd minus the previous point's tvlUsd for
the same chain and stays empty on the first point. Sort by chain and
date. Report how many points came back for each chain. Do not fill
missing dates with estimates.

Ethereum
peer chain name

Replace the peer chain line with your own, and keep the first run to the two chains you actually need

Estimated tool cost

The Purrkey catalog lists defillama.chain.tvl_history at POST /v1/runs, unit call, $0.0005 per call (unitPriceMicros 500), read through the catalog on November 17, 2026. The price rule reads: "Fixed per-call price under the published tool contract; failed executions are not charged."

StepFormulaUnit pricePlanned quantityTotal
Two chains, 90 dayscalls x price$0.0005 per call2$0.0010
One chain, 30 dayscalls x price$0.0005 per call1$0.0005
Six chains, 365 dayscalls x price$0.0005 per call6$0.0030

Quantity is calls, not days, because a call returns the whole window for one chain. The totals assume each call succeeds; a failed execution is not charged, so the figures are a ceiling rather than a settled bill. Model fees for the agent are not counted here

Run the comparison

Pick the two chains your review covers and send the prompt with the real names filled in. The tool page sits at defillama?q=tvl_history, where the current input schema and price are listed before you spend a call

Get started by giving this to your agent

  • Claude Code
  • Codex
  • Gemini CLI
  • Cursor
  • GitHub Copilot
Set up https://purrkey.app/SKILL.md, then use Purrkey to show me what I can do with DefiLlama.
Explore DefiLlama tools and pricing

FAQ

How do I get a blockchain's daily TVL history from DefiLlama?

Call defillama.chain.tvl_history with the chain name and a day count. The response holds the chain name and an array of points, and each point carries a date and a tvlUsd value.

What does the days input accept?

days is an integer from 1 to 365 and defaults to 30 when you leave it out. A 90-day request has to pass days: 90 explicitly, otherwise the call returns the 30-day default window.

Does the tool return a day-over-day change?

No. Each point carries date and tvlUsd and nothing else, so changeVsPreviousDay has to be computed from consecutive points by whoever builds the table.

How much does it cost to pull six chains for 365 days?

One call per chain, so six calls at $0.0005 per call, which is $0.003. Failed executions are not charged under the tool's price rule.

Can one call return several chains at once?

The chain input takes one blockchain name, so a comparison across chains needs one call per chain. Two chains over 90 days is two calls.

What format is the date field in?

The contract types date as an integer and does not describe its encoding any further. Look at one response before you write date formatting into a sheet.

Why is the first row of the change column empty?

The first point of a series has no earlier point to subtract, so changeVsPreviousDay stays blank there. Later rows subtract the previous point's tvlUsd.

Next step

Try this with DefiLlama

The tool directory lists every endpoint with its current price. Inspect the inputs there, then let your agent run a small batch before scaling up.

See DefiLlama tools

Share this article