mondovswap volume categories
Updated 2024-04-02
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
›
⌄
with prices_tab as (
SELECT price,
hour,
token_address
FROM base.price.ez_hourly_token_prices
WHERE price > 0 AND token_address IS NOT NULL
),
all_swaps as (
SELECT
AMOUNT_OUT,
price,
tx_hash,
origin_from_address
-- avg(AMOUNT_OUT*price) as "Average volume per swap",
-- COUNT(DISTINCT tx_hash) as daily_swaps,
-- COUNT(DISTINCT origin_from_address) as daily_swappers
FROM base.defi.ez_dex_swaps s
JOIN prices_tab p ON (s.token_out = p.token_address AND date_trunc('hour', s.block_timestamp) = p.hour)
WHERE platform = 'baseswap'
-- ORDER BY "Total volume" DESC
)
SELECT
COUNT(DISTINCT tx_hash) as swaps,
CASE WHEN (amount_out*price) <= 10 THEN '< $10'
WHEN (amount_out*price) > 10 AND (amount_out*price) <= 100 THEN '$10 - $100'
WHEN (amount_out*price) > 100 AND (amount_out*price) <= 500 THEN '$100 - $500'
WHEN (amount_out*price) > 500 AND (amount_out*price) <= 1000 THEN '$500 - $1,000'
WHEN (amount_out*price) > 1000 AND (amount_out*price) <= 10000 THEN '$1,000 - $10,000'
ELSE '$10,000 +'
END AS volume_category
FROM all_swaps
GROUP BY volume_category
QueryRunArchived: QueryRun has been archived