cryptoshepherd_ monthly DEX swaps on Arbitrum
Updated 2024-08-19
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
30
31
32
33
34
35
36
›
⌄
--Monthly Uniswap V2 swaps on Arbitrum
with monthly_swaps as (
SELECT
CASE
WHEN platform ILIKE '%uniswap%' THEN 'uniswap'
WHEN platform ILIKE '%trader-joe%' THEN 'trader-joe'
WHEN platform ILIKE '%zyberswap%' THEN 'zyberswap'
WHEN platform ILIKE '%camelot%' THEN 'camelot'
WHEN platform ILIKE '%kyberswap%' THEN 'kyberswap'
ELSE 'other'
END as dex,
count(*) as TOTAL_SWAPS,
DATE_TRUNC('month', block_timestamp) as month
FROM
arbitrum.defi.ez_dex_swaps
WHERE
block_timestamp >= DATE_TRUNC('year', CURRENT_DATE)
and block_timestamp < DATE_TRUNC('month', CURRENT_DATE) --and platform = 'uniswap-v2'
GROUP BY
month,
dex
),
swap_lag as(
SELECT
month,
dex,
total_swaps,
LAG(total_swaps) OVER(
ORDER BY
month asc
) as prev_month_swaps
FROM
monthly_swaps
)
SELECT
month,
QueryRunArchived: QueryRun has been archived