h4wkUni top 100 monthly cohort
Updated 2023-08-16
999
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
›
⌄
with price as (
select hour as price_hour,
token_address as price_token_address,
symbol as price_symbol,
avg(price) as price
from ethereum.core.fact_hourly_token_prices
group by 1,2,3
)
, top_buy as (
select date_trunc('month', block_timestamp) as month,
'BUY' as type,
token_out as token_address,
price_symbol,
sum(amount_out) as total_amount,
sum(amount_out*price) as total_amount_usd,
row_number () over (partition by month order by total_amount_usd desc) rn
FROM ethereum.core.ez_dex_swaps
join price on (date_trunc('hour', block_timestamp) = price_hour
and token_out = price_token_address)
where platform ilike '%uniswap%'
and amount_out*price < 10000000 -- Remove overflowing outlier
group by 1,2,3,4
qualify rn <= 100
)
, top_sell as (
select date_trunc('month', block_timestamp) as month,
'SELL' as type,
token_in as token_address,
price_symbol as symbol,
sum(amount_in) as total_amount,
sum(amount_in*price) as total_amount_usd,
row_number () over (partition by month order by total_amount_usd desc) rn
FROM ethereum.core.ez_dex_swaps
join price on (date_trunc('hour', block_timestamp) = price_hour
and token_in = price_token_address)
Run a query to Download Data