> ## 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.

# Interest rates

> Every rate update in every lending market.

<Info>
  **In progress.** This table is not served yet. The page documents it as it lands.
</Info>

`facts.lending_market_interest_rates` combines the rate updates of every lending protocol we decode into one table: one row per rate update in a lending market. The market's contract emits its new rates whenever its balance of deposits and borrows changes. `lending_market_id` keys each row to its market in the [Registry](/docs/catalog/lending/registry).

## Columns

<table>
  <thead>
    <tr>
      <th width="280">Column</th>
      <th width="130">Type</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>block\_timestamp</code></td>
      <td><code>TIMESTAMP</code></td>
      <td>Time of the block containing the update. Partition column.</td>
    </tr>

    <tr>
      <td><code>block\_number</code></td>
      <td><code>INT64</code></td>
      <td>Number of the block containing the update.</td>
    </tr>

    <tr>
      <td><code>transaction\_hash</code></td>
      <td><code>STRING</code></td>
      <td>Hash of the transaction that emitted the update.</td>
    </tr>

    <tr>
      <td><code>log\_index</code></td>
      <td><code>INT64</code></td>
      <td>Position of the update event in the block.</td>
    </tr>

    <tr>
      <td><code>unique\_id</code></td>
      <td><code>INT64</code></td>
      <td>Row key: fingerprint of <code>chain\_id</code>, <code>block\_number</code>, <code>transaction\_hash</code>, <code>log\_index</code>.</td>
    </tr>

    <tr>
      <td><code>chain\_id</code></td>
      <td><code>STRING</code></td>
      <td>Chain the market runs on.</td>
    </tr>

    <tr>
      <td><code>lending\_market\_id</code></td>
      <td><code>STRING</code></td>
      <td>Market the rates belong to; joins <code>dimensions.lending\_markets</code>.</td>
    </tr>

    <tr>
      <td><code>project\_id</code></td>
      <td><code>STRING</code></td>
      <td>Protocol operating the market, such as <code>aave</code>.</td>
    </tr>

    <tr>
      <td><code>token\_id</code></td>
      <td><code>STRING</code></td>
      <td>Underlying token of the market: <code>\{token\_address}-\{chain\_id}</code>.</td>
    </tr>

    <tr>
      <td><code>deposit\_rate</code></td>
      <td><code>FLOAT64</code></td>
      <td>Annual rate paid to depositors, as a fraction.</td>
    </tr>

    <tr>
      <td><code>borrow\_rate</code></td>
      <td><code>FLOAT64</code></td>
      <td>Annual rate charged to borrowers, as a fraction.</td>
    </tr>
  </tbody>
</table>

## Sample queries

<Warning>
  The table is partitioned on `block_timestamp`. Bound that column in every query; without a bound the query reads the whole table.
</Warning>

<Tabs>
  <Tab title="Latest rates">
    **Read the latest rates of every market in one protocol.**

    ```sql theme={null}
    select
        markets.market_name,
        markets.chain_id,
        rates.deposit_rate,
        rates.borrow_rate
    from `facts.lending_market_interest_rates` as rates
    join `dimensions.lending_markets` as markets
        using (lending_market_id)
    where markets.project_id = 'spark'
      and rates.block_timestamp >= timestamp('2026-08-20')
    qualify row_number() over (
        partition by rates.lending_market_id
        order by rates.block_timestamp desc
    ) = 1
    order by rates.deposit_rate desc
    ```
  </Tab>

  <Tab title="Rate history">
    **Read one market's daily average rates over a month.**

    ```sql theme={null}
    select
        timestamp_trunc(rates.block_timestamp, day) as day,
        avg(rates.deposit_rate) as deposit_rate,
        avg(rates.borrow_rate) as borrow_rate
    from `facts.lending_market_interest_rates` as rates
    join `dimensions.lending_markets` as markets
        using (lending_market_id)
    where markets.project_id = 'aave'
      and markets.underlying_symbol = 'WETH'
      and markets.chain_id = 'ethereum'
      and rates.block_timestamp >= timestamp('2026-08-01')
      and rates.block_timestamp < timestamp('2026-09-01')
    group by day
    order by day
    ```
  </Tab>
</Tabs>
