Skip to content

Conversation

brunota20
Copy link
Collaborator

Description:

Add volume and liquidity by day per pools, assuming events initiating as "SelfPeggingAsset_evt_"

@brunota20 brunota20 requested a review from mendesfabio March 13, 2025 13:58
@brunota20 brunota20 self-assigned this Mar 13, 2025
@github-actions github-actions bot marked this pull request as draft March 13, 2025 13:58
LEFT JOIN {{ source(blockchain, prices_table) }} p1 ON rb.token1_address = p1.token_address AND rb.day = p1.day
),

volume_data AS (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be great to have a daily metrics view but I suggest we keep it separate for now. this should be the liquidity (only) spell and in the future we can merge in another spell the main metrics: fees, liquidity, volume.

WHEN f.token0_symbol IS NULL OR f.token1_symbol IS NULL THEN NULL
ELSE concat(LEAST(f.token0_symbol, f.token1_symbol), '-', GREATEST(f.token0_symbol, f.token1_symbol))
END AS pair_symbols,
f.token0_balance_scaled AS token0_balance,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should replace token0 and token1 for token

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also keep the raw balances

GROUP BY 1, 2, 3, 4, 5, 6
)

running_balance AS (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think running balance is correct. Remember events give you the delta amounts added/removed to the pool. You have to SUM() OVER() the amounts to get balances

@brunota20 brunota20 marked this pull request as ready for review May 15, 2025 00:21
brunota20 pushed a commit that referenced this pull request Jun 23, 2025
* fix: inclusion criteria

* refactor: add exceptions & adjust conditions

* fix: temp remove deposit updates logic + fix joins

* fix: dedupe

* fix: uniqueness

* fix: token_id non-nullable

* feat: add staked per token & tranche

* fix: missing column

---------

Co-authored-by: jeff-dude <[email protected]>
brunota20 pushed a commit that referenced this pull request Jun 23, 2025
…lytics#8260)

* fix: version

* fix: update ref

* feat: add forward fill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants