[645] Create amm tvl metrics (liquidity_pools_tvl) in tvl_agg#222
Merged
taha-aziz merged 3 commits intorelease-v20260413from Apr 9, 2026
Merged
[645] Create amm tvl metrics (liquidity_pools_tvl) in tvl_agg#222taha-aziz merged 3 commits intorelease-v20260413from
taha-aziz merged 3 commits intorelease-v20260413from
Conversation
There was a problem hiding this comment.
Pull request overview
Adds AMM/liquidity pool TVL into the existing tvl_agg mart so downstream reporting can include assets locked in Stellar AMM pools (in raw token amounts), not just DEX orderbook selling-liabilities TVL.
Changes:
- Adds a new
liquidity_pools_tvlmetric sourced fromasset_balances__daily_agg.liquidity_pool_balance. - Updates
tvl_aggto includeliquidity_pools_tvland incorporate it intototal_tvl. - Extends schema + docs to describe and test the new column.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| models/marts/tvl/tvl_agg.sql | Adds AMM TVL CTE and joins it into the aggregated TVL output. |
| models/marts/tvl/tvl_agg.yml | Updates model description and adds schema tests for liquidity_pools_tvl. |
| models/docs/marts/tvl/tvl_agg.md | Adds documentation block for liquidity_pools_tvl and updates total_tvl docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
amishas157
reviewed
Apr 2, 2026
Contributor
amishas157
left a comment
There was a problem hiding this comment.
@taha-aziz Can you also rebase against latest release-v20260407
I pushed some changes, recency tests should look differently https://github.com/stellar/stellar-dbt-public/blob/release-v20260407/models/marts/tvl/tvl_agg.yml
c5505b4 to
abaab05
Compare
4d87947 to
b3d8767
Compare
amishas157
reviewed
Apr 9, 2026
amishas157
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
PR Structure
otherwise).
Thoroughness
Release planning
semver, and I've changed the name of the BRANCH to major/* , minor/* or patch/* .
What
https://github.com/stellar/stellar-dbt/issues/645
Why
SDF is taking over reporting TVL of our AMM from Lumenswap. This PR creates the
liquidity_pools_tvlwhich is the raw asset balance of each asset locked for AMM.Currently,
tvl_aggonly tracks DEX orderbook TVL viaselling_liabilitiesfrom accounts (XLM) and trustlines (non-XLM). It completely misses AMM/liquidity pool TVL — the actual token amounts locked in pools. Theasset_balances__daily_aggmodel already computesliquidity_pool_balanceper asset per day (sourced fromint_account_balances__liquidity_pools, which decomposes pool shares into underlying asset amounts). We're pulling this column intotvl_aggas a newliquidity_pools_tvlcolumn.Known limitations
We will have to fully rebuild our
tvl_aggmodel to include this new column so it has it historically