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

# Liquidity Pools Snapshot

> Reference documentation for the Liquidity Pools Snapshot table in Hubble's Silver data dictionary.

## Table Metadata

| Property | Configuration |
| - | - |
| Natural Key(s) | liquidity\_pool\_id, valid\_from |
| Partition Field(s) | valid\_to (MONTH partition) |
| Clustered Field(s) | liquidity\_pool\_id |
| Documentation | [dbt docs](http://www.stellar-dbt-docs.com/#!/model/model.stellar_dbt_public.liquidity_pools_snapshot) |

## Column Details

| Name | Description | Data Type | Domain Values | Required? | Notes |
| - | - | - | - | - | - |
| liquidity\_pool\_id | Unique identifier for a liquidity pool. | STRING | | Yes | Natural Key. Cluster Field. Cannot be duplicated for same asset pair. |
| type | Mechanism that calculates pricing and division of shares for the pool. | STRING | constant\_product | Yes | Initially only constant product pools are supported. See [CAP-38](https://github.com/stellar/stellar-protocol/blob/master/core/cap-0038.md). |
| fee | Basis points charged as trade fee. | INTEGER | Default = 30 | Yes | Fees are distributed immediately to accounts as transactions complete. |
| trustline\_count | Total number of accounts with trustlines authorized to the pool. | INTEGER | | Yes | Revoking authorization on an asset will withdraw accounts from all pools with that asset. |
| pool\_share\_count | Total number of pool shares representing participation in the liquidity pool. | FLOAT | | Yes | Shares are not transferable. Can only be adjusted via deposit/withdraw. |
| asset\_a\_type | Asset type for one side of the pool (sold asset). | STRING | <ul><li>credit\_alphanum4</li><li>credit\_alphanum12</li><li>native</li></ul> | Yes | XLM has type = 'native'. No asset code/issuer. |
| asset\_a\_code | Asset code (4 or 12 chars) for sold asset in trade. | STRING | | No | Asset codes alone are not unique. Combination with issuer + type is unique. |
| asset\_a\_issuer | Account address of the original issuer of the sold asset. | STRING | | No | |
| asset\_a\_id | Farm Hash encoding of asset code + issuer + type for asset A. | INTEGER | | No | |
| asset\_a\_amount | Raw number of tokens locked in the pool for asset A. | FLOAT | | Yes | |
| asset\_b\_type | Asset type for the other side of the pool. | STRING | <ul><li>credit\_alphanum4</li><li>credit\_alphanum12</li><li>native</li></ul> | Yes | XLM has type = 'native'. |
| asset\_b\_code | Asset code (4 or 12 chars) for other asset in trade. | STRING | | No | Asset codes alone are not unique. Combination with issuer + type is unique. |
| asset\_b\_issuer | Account address of the original issuer of the other asset. | STRING | | No | |
| asset\_b\_id | Farm Hash encoding of asset code + issuer + type for asset B. | INTEGER | | No | |
| asset\_b\_amount | Raw number of tokens locked in the pool for asset B. | FLOAT | | Yes | |
| last\_modified\_ledger | Ledger sequence number when the pool entry was last modified. | INTEGER | | Yes | Natural Key. Cluster Field. Deletion does not count as modification. |
| ledger\_entry\_change | Code describing the ledger entry change type. | INTEGER | <ul><li>0 - Ledger Entry Created</li><li>1 - Ledger Entry Updated</li><li>2 - Ledger Entry Deleted</li><li>3 - Ledger Entry State (value of the entry)</li></ul> | Yes | Updates not valid for claimable balances. |
| deleted | Indicates whether the liquidity pool entry was deleted. | BOOLEAN | true, false | Yes | Deleted entries cannot be recovered; history is maintained. |
| batch\_id | String representation of the run id for a given DAG in Airflow. Takes the form of `scheduled__<batch_end_date>-<dag_alias>`. Batch ids are unique to the batch and help with monitoring and rerun capabilities | string | | Yes | |
| batch\_run\_date | Start date for the batch interval. | DATETIME | | Yes | Proxy for closed\_at. |
| closed\_at | Timestamp in UTC when ledger closed and committed. | TIMESTAMP | | Yes | Ledgers close \~every 5 seconds. |
| ledger\_sequence | Ledger sequence number. | INTEGER | | Yes | Represents order of ledger within Stellar blockchain. |
| batch\_insert\_ts | Timestamp in UTC when batch was inserted into DB. | TIMESTAMP | | Yes | Used for engineering/debugging, not analysis. |
| airflow\_start\_ts | Timestamp when airflow job started. | STRING | | Yes | Helps detect backfill loads. |
| valid\_from | Timestamp when this snapshot row became effective. | TIMESTAMP | | Yes | Helps track changes over time. |
| valid\_to | Timestamp when this row is no longer valid. | TIMESTAMP | | No | Null = still active. |

## Example Business Questions

1. What was the total liquidity (asset\_a\_amount + asset\_b\_amount) across all pools on a given date?

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT
  DATE('2025-01-15') AS as_of_date,
  SUM(asset_a_amount + asset_b_amount) AS total_liquidity
FROM `crypto-stellar.snapshots.liquidity_pools_snapshot`
WHERE DATE(valid_from) <= DATE('2025-01-15')
  AND (DATE(valid_to) > DATE('2025-01-15') OR valid_to IS NULL)
  AND deleted = FALSE;
```
