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

# solana_utils.daily_balances

> Historical daily SOL and SPL token balances for every address on Solana.

export const TableSample = ({tableName, tableSchema}) => <>
    <div className="hidden dark:block">
      <iframe src={`https://dune.com/embeds/3419983/5785629?table_schema_t6f0df=${tableSchema}&table_name_t6f0df=${tableName}&darkMode=true`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
    </div>
    <div className="dark:hidden">
      <iframe src={`https://dune.com/embeds/3419983/5785629?table_schema_t6f0df=${tableSchema}&table_name_t6f0df=${tableName}`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
    </div>
  </>;

The `solana_utils.daily_balances` table provides end-of-day balance snapshots for every address on Solana, covering both native SOL and SPL token holdings. This table is the historical counterpart to `solana_utils.latest_balances`.

Each row represents the balance for a specific address, token, and day. The table is partitioned by `month` for query performance and is sourced from `solana.account_activity`.

### When to Use This Table

* Track historical balance changes for a wallet over time
* Analyze token holder distribution trends
* Build time-series portfolio valuation charts
* Monitor treasury balances for Solana DAOs and protocols

### Query Performance

**Partition key:** `month`

Always include a time filter (`day` range) and filter on `address` or `token_mint_address` for best performance.

```sql theme={null}
-- ✅ Good: specific address + time range
SELECT *
FROM solana_utils.daily_balances
WHERE address = 'FG4Y3yX4AAchp1HvNZ7LfzFTewF2f6nDoMDCohTFrdpk'
  AND day >= DATE '2025-01-01'

-- ❌ Slow: no time or address filter
SELECT * FROM solana_utils.daily_balances
WHERE token_mint_address = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
```

## Table Schema

Examples are illustrative values for a Solana SPL token account holding USDC. They are not a live balance snapshot.

| Column | Type | Description | Example |
| - | - | - | - |
| `day` | `TIMESTAMP` | Day of the balance snapshot | `2025-01-15 00:00:00` |
| `month` | `DATE` | Month partition key | `2025-01-01` |
| `address` | `VARCHAR` | Solana wallet address | `FG4Y3yX4AAchp1HvNZ7LfzFTewF2f6nDoMDCohTFrdpk` |
| `sol_balance` | `DOUBLE` | Native SOL balance at end of day | `0.00203928` |
| `token_mint_address` | `VARCHAR` | Mint address of the SPL token | `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` |
| `token_balance` | `DECIMAL(38,18)` | SPL token balance in display units | `1000.000000000000000000` |
| `token_balance_owner` | `VARCHAR` | Owner of the token balance | `HaeE7fyaDjG8fRbSuw5RkKLLgTirQE2Mhosuy7pmFxKh` |
| `block_time` | `TIMESTAMP` | Block time of the last balance change | `2025-01-15 12:00:00` |
| `block_slot` | `BIGINT` | Block slot of the last balance change | `313000000` |
| `unique_address_key` | `VARCHAR` | Surrogate key for address + token + day combination | `fc55cc6f6477c6664bc84e7e3aabd002` |
| `updated_at` | `TIMESTAMP` | When this record was last updated | `2025-01-15 13:00:00` |

## Table Sample

<TableSample tableSchema="solana_utils" tableName="daily_balances" />

## Example Queries

**Daily SOL balance for a wallet over the last 30 days:**

```sql theme={null}
SELECT
  day,
  sol_balance,
  token_balance,
  token_mint_address
FROM solana_utils.daily_balances
WHERE address = 'FG4Y3yX4AAchp1HvNZ7LfzFTewF2f6nDoMDCohTFrdpk'
  AND day >= NOW() - INTERVAL '30' DAY
ORDER BY day DESC
```

**Track USDC balance history for an address:**

```sql theme={null}
SELECT
  day,
  token_balance
FROM solana_utils.daily_balances
WHERE address = 'FG4Y3yX4AAchp1HvNZ7LfzFTewF2f6nDoMDCohTFrdpk'
  AND token_mint_address = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' -- USDC
  AND day >= DATE '2025-01-01'
ORDER BY day
```


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