> ## Documentation Index
> Fetch the complete documentation index at: https://tokenterminal.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> To query the Token Terminal data catalog, read https://tokenterminal.com/docs/catalog/agents-manual.md first. It is the whole catalog as one page: table naming grammar, key columns, partition and cluster rules, units, additivity, and the tables that are documented but not served yet.
> Never query a catalog table on a time bound alone. Also filter its cluster key, which you read from INFORMATION_SCHEMA.COLUMNS; an empty result means the object is a view, whose pruning contract is on its page. Compute is billed to the caller's own Google Cloud project.

# Metrics

> Daily lending figures per project, app, market and reserve.

TVL, active loans, collateral, fees and revenue, in USD. One row per thing per day, at four grains: project, app, market and reserve.

TVL, active loans and collateral are balances, not flows. They add up across reserves, markets, apps and chains, but never across days: a week's figure is the last day in it, and adding seven days counts the same balance seven times. Fees and revenue are flows and add up both ways. [Metric definitions](https://tokenterminal.com/docs/catalog/metric-definitions.md) has the rule in full.

## Tables

A tab per grain. [Coverage](https://tokenterminal.com/docs/catalog/lending.md) shows which apps report which measure.

**Project**

One row per project per day.

<table>
  <thead>
    <tr>
      <th width="330">Table</th>
      <th width="190">Value column</th>
      <th>What it holds</th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`metrics_projects.tvl_daily`</td><td>`tvl`</td><td>Total value locked.</td></tr>
    <tr><td>`metrics_projects.active_loans_daily`</td><td>`active_loans`</td><td>USD value of open loans (outstanding borrows).</td></tr>
    <tr><td>`metrics_projects.collateral_daily`</td><td>`collateral`</td><td>USD value of deposits actively backing an open loan.</td></tr>
    <tr><td>`metrics_projects.fees_daily`</td><td>`fees`</td><td>Total fees paid by users.</td></tr>
    <tr><td>`metrics_projects.fees_supply_side_daily`</td><td>`fees_supply_side`</td><td>Fees paid out to the supply side.</td></tr>
    <tr><td>`metrics_projects.revenue_daily`</td><td>`revenue`</td><td>Fees retained by the protocol.</td></tr>
  </tbody>
</table>

**App**

One row per app per day.

<table>
  <thead>
    <tr>
      <th width="330">Table</th>
      <th width="190">Value column</th>
      <th>What it holds</th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`metrics_apps.tvl_daily`</td><td>`tvl`</td><td>Total value locked in the app.</td></tr>
    <tr><td>`metrics_apps.active_loans_daily`</td><td>`active_loans`</td><td>USD value of open loans (outstanding borrows) across the app's lending markets.</td></tr>
    <tr><td>`metrics_apps.collateral_daily`</td><td>`collateral`</td><td>USD value of deposits actively backing an open loan across the app's lending markets.</td></tr>
    <tr><td>`metrics_apps.fees_daily`</td><td>`fees`</td><td>Fees paid by users of the app across every chain it runs on.</td></tr>
    <tr><td>`metrics_apps.fees_supply_side_daily`</td><td>`fees_supply_side`</td><td>Fees the app passed through to builders and, on HIP-3 markets, to market deployers.</td></tr>
    <tr><td>`metrics_apps.revenue_daily`</td><td>`revenue`</td><td>Fees the app retained across every chain it runs on.</td></tr>
  </tbody>
</table>

**Market**

One row per market per day.

<table>
  <thead>
    <tr>
      <th width="330">Table</th>
      <th width="190">Value column</th>
      <th>What it holds</th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`metrics_lending_markets.tvl_daily`</td><td>`tvl`</td><td>USD value of deposits supplied to the lending market (idle + borrowed).</td></tr>
    <tr><td>`metrics_lending_markets.active_loans_daily`</td><td>`active_loans`</td><td>USD value of open loans (outstanding borrows) on the market.</td></tr>
    <tr><td>`metrics_lending_markets.collateral_daily`</td><td>`collateral`</td><td>USD value of deposits actively backing an open loan on the market.</td></tr>
  </tbody>
</table>

**Reserve**

One row per market and token per day.

<table>
  <thead>
    <tr>
      <th width="330">Table</th>
      <th width="190">Value column</th>
      <th>What it holds</th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`metrics_lending_market_reserves.tvl_daily`</td><td>`tvl`</td><td>USD value of deposits supplied to the reserve (idle + borrowed).</td></tr>
    <tr><td>`metrics_lending_market_reserves.active_loans_daily`</td><td>`active_loans`</td><td>USD value of open loans (outstanding borrows) against the reserve.</td></tr>
    <tr><td>`metrics_lending_market_reserves.collateral_daily`</td><td>`collateral`</td><td>USD value of the reserve's deposits actively backing an open loan.</td></tr>
  </tbody>
</table>

## Sample queries

**One market's series**

Each measure is its own table, so a row with both is a join on `lending_market_id` and `timestamp`, bounded on every side. Join the loans side with `left join`: a market can hold value with no loans open against it.

```sql theme={null}
with markets as (
    select lending_market_id, lending_market_name
    from `dimensions.lending_markets`
    where chain_id = 'ethereum'
      and app_id = 'aave-v3'
),

locked as (
    select lending_market_id, timestamp, tvl
    from `metrics_lending_markets.tvl_daily`
    where chain_id = 'ethereum'
      and timestamp >= timestamp('2026-06-01')
),

loans as (
    select lending_market_id, timestamp, active_loans
    from `metrics_lending_markets.active_loans_daily`
    where chain_id = 'ethereum'
      and timestamp >= timestamp('2026-06-01')
)

select
    locked.timestamp,
    markets.lending_market_name,
    locked.tvl,
    loans.active_loans
from locked
join markets
    using (lending_market_id)
left join loans
    using (lending_market_id, timestamp)
order by locked.timestamp
```

**Every protocol, ranked**

The project grain rolls up every app and chain a protocol runs, so one row is the protocol's whole business.

```sql theme={null}
select
    project_id,
    active_loans
from `metrics_projects.active_loans_daily`
where timestamp = timestamp('2026-09-01')
order by active_loans desc
limit 25
```

**One app across chains**

`metrics_apps_by_chain` splits an app's daily figure by the chain it sits on, keyed on `app_id` and `chain_id` together.

```sql theme={null}
select
    timestamp,
    chain_id,
    tvl
from `metrics_apps_by_chain.tvl_daily`
where app_id = 'aave-v3'
  and timestamp >= timestamp('2026-08-01')
order by timestamp, tvl desc
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.