Saleh4-eth-swaps-pairs
Updated 2024-01-15
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 lst_price as (
select
hour::date as day
,avg(price) as avg_price
from ethereum.price.fact_hourly_token_prices
where hour::date>='2023-08-01'
and TOKEN_ADDRESS ='0x5e8422345238f34275888049021821e8e08caa1f'
group by 1
order by 1 desc
-- limit 30
)
,lst_top_pairs as (
select top 10
split_part(POOL_NAME,' ',0) as select_pair
,count(DISTINCT tx_hash) as tx_count
,count(DISTINCT sender) as swaper
from ethereum.defi.ez_dex_swaps
join ethereum.core.dim_labels on address = CONTRACT_ADDRESS
join lst_price on block_timestamp::date = day
where block_timestamp::date>='2023-08-01'
group by 1
order by tx_count desc
)
select
block_timestamp::date as date
-- ,iff(block_timestamp::date<='2023-08-16','before_fall','after_fall') as status
,split_part(POOL_NAME,' ',0) as pair
,count(DISTINCT tx_hash) as tx_count
,count(DISTINCT sender) as swaper
from ethereum.defi.ez_dex_swaps
join ethereum.core.dim_labels on address = CONTRACT_ADDRESS
join lst_price on block_timestamp::date = day
where block_timestamp::date>='2023-08-01'
and pair in(select select_pair from lst_top_pairs)
group by 1,2
QueryRunArchived: QueryRun has been archived