-
Notifications
You must be signed in to change notification settings - Fork 0
Add liquidity and volume query by day per pool for tapio protocol #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
LEFT JOIN {{ source(blockchain, prices_table) }} p1 ON rb.token1_address = p1.token_address AND rb.day = p1.day | ||
), | ||
|
||
volume_data AS ( |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ( |
There was a problem hiding this comment.
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
* 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]>
…lytics#8260) * fix: version * fix: update ref * feat: add forward fill
Description:
Add volume and liquidity by day per pools, assuming events initiating as "SelfPeggingAsset_evt_"