Skip to content
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

Add Solana DEX Metrics #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions queries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ query_ids:
- 4424
- 21689
- 4234
- 3084516
17 changes: 17 additions & 0 deletions queries/solana_dex_volumes___3084516.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- part of a query repo
-- query name: Solana DEX Volumes
-- query link: https://dune.com/queries/3084516


--colors phoe F37A44 whirl FFCE5B ray AB0DEB lif 5D5AE5 meteora 609A00 goosefx 726FFF
SELECT
date_trunc('week', block_time) as time
, project
, sum(amount_usd) as amount_usd
, sum(COALESCE(amount_usd, tr.token_bought_amount*p.median_price)) as amount_usd_other
FROM dex_solana.trades tr
LEFT JOIN dune.dune.result_dex_prices_solana p ON p.token_mint_address = tr.token_bought_mint_address
AND date_trunc('day',tr.block_time) = p.day
AND rolling_two_months_trades > 100
WHERE block_time > timestamp '{{start date}}'
group by 1, 2