Skip to content

An 6028/testing-metrics-dex #454

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

Merged
merged 10 commits into from
May 21, 2025
Merged

An 6028/testing-metrics-dex #454

merged 10 commits into from
May 21, 2025

Conversation

sam-xyz
Copy link
Member

@sam-xyz sam-xyz commented May 16, 2025

  1. New model silver_metrics__dex_comparison which does the following:
    a. Compares dex volumes in the last 7 days for all chains in our complete dex swaps model against Defillama's dex volume table by chain
    b. logs ONLY the top 5 protocols by volume that Defillama has that we currently DO not curate. This is also fuzzy matched and stripped off of any protocol versions. (v2 of this could be measuring against protocols that are in common too)

  2. silver_metrics__dex_comparison yml file will error IF there is a protocol that did > 10% of total defillama dex volume in the past 7 days AND we do not have that protocol curated

  3. 2 tables for the above 2 tables but for bridges

  4. 1 new table to compare on a chain level for dex and bridge categories

  5. new workflow that runs weekly on Monday to runs the model and test the data

dbt run -m models/silver/ai_metrics/defillama_comparison --full-refresh

GROUP BY
ALL
),
crosschain_total_volume AS (
Copy link
Collaborator

Choose a reason for hiding this comment

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

technically you don't need the second CTE to roll up to the blockchain level, you can add this to line 46 for example:
SUM(crosschain_volume) OVER(partition by blockchain) total

Copy link
Member Author

Choose a reason for hiding this comment

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

good point, fixed

Copy link
Member Author

Choose a reason for hiding this comment

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

wait, small difference here. if I write the cumulative sum in the same cte, i'll be summing for chains where defillama has no dex data but we do like gnosis, then we'd face the division by 0 error.

If it's summed outside the cte, we're only comparing chains where both defillama + our data has data for

blockchain,
platform_name,
defillama_volume,
defillama_volume_percent,
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not land the crosschain volume here as well?

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh nevermind, this is meant to just be what's missing

platform_name
)
WHERE
crosschain_volume IS NULL
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is assuming if we have the platform we have full coverage? Do you think it makes sense to compare the actual volumes?

@sam-xyz sam-xyz merged commit 97553b8 into main May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants