MLDZMNcosmo9
Updated 2022-10-12Copy 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
30
31
›
⌄
with tb1 as (select
label,
sum(FROM_AMOUNT/pow(10,FROM_DECIMAL)) as volume,
count(tx_id) as no_swaps,
count(distinct trader) as swapper
from osmosis.core.fact_swaps s left join osmosis.core.dim_labels b on s.FROM_CURRENCY=b.address
where(POOL_IDS[0]=722) and TX_STATUS='SUCCEEDED'
and BLOCK_TIMESTAMP>=CURRENT_DATE-7
group by 1 having label is not null
order by 3 desc limit 10),
tb2 as (select
distinct trader as sender,
label as token,
count(distinct tx_id) as no_transaction
from osmosis.core.fact_swaps s left join osmosis.core.dim_labels b on s.FROM_CURRENCY=b.address
where POOL_IDS[0]=722
and TX_STATUS='SUCCEEDED'
and BLOCK_TIMESTAMP>=CURRENT_DATE-7
and label in (select label from tb1)
group by 1,2)
select
token,
case
when no_transaction=1 then 'One swap'
when no_transaction>1 then 'More than one swap'
end as buckets,
count(distinct sender) as count_users
from tb2
group by 1,2
Run a query to Download Data