dannyamahDaily Swap Transactions
Updated 2024-12-31Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
›
⌄
WITH swaps AS (
SELECT
date_trunc('day', s.block_timestamp) AS date,
s.tx_id,
s.swapper,
coalesce(l1.label, s.swap_from_mint) AS sold,
swap_from_amount,
coalesce(l2.label, s.swap_to_mint) AS bought,
swap_to_amount
FROM
solana.core.fact_transfers t
JOIN solana.defi.fact_swaps_jupiter_summary s
ON s.tx_id = t.tx_id
LEFT JOIN solana.core.dim_labels l1
on l1.address = s.swap_from_mint
LEFT JOIN solana.core.dim_labels l2
on l2.address = s.swap_to_mint
WHERE 1 = 1
AND t.tx_to = 'GbKKt2QquzQkGDeXH8Fdw1DjP1UMhszy7L4AHh68EFyw'
)
SELECT
date,
COUNT(tx_id) AS daily_swaps,
SUM(daily_swaps) OVER (ORDER BY date) AS cumulative_swaps
FROM swaps
GROUP BY date
ORDER BY date DESC;
QueryRunArchived: QueryRun has been archived