Afonso_DiazOvertime
Updated 2024-10-27
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
›
⌄
with
main as (
select
block_timestamp,
tx_hash,
to_address as user,
amount,
'From Cex' as type
from ethereum.core.ez_token_transfers
where contract_address = '0x6c3ea9036406852006290770bedfcaba0e23a0e8'
and origin_from_address in (select distinct address from ethereum.core.dim_labels where label_type = 'cex')
and block_timestamp::date between '{{ start_date }}' and '{{ end_date }}'
union all
select
block_timestamp,
tx_hash,
origin_from_address as user,
amount,
'To Cex' as type
from ethereum.core.ez_token_transfers
where contract_address = '0x6c3ea9036406852006290770bedfcaba0e23a0e8'
and to_address in (select distinct address from ethereum.core.dim_labels where label_type = 'cex')
and block_timestamp::date between '{{ start_date }}' and '{{ end_date }}'
)
select
date_trunc('{{ period }}', block_timestamp) as date,
type,
count(distinct tx_hash) as transactions,
count(distinct user) as users,
sum(amount) as volume_usd,
avg(amount) as average_amount_usd,
median(amount) as median_amount_usd,
QueryRunArchived: QueryRun has been archived