BlockTrackerTrade volume by platform
Updated 2024-07-17
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 prices as (
select
hour,
symbol,
price
from base.price.ez_prices_hourly
where token_address IN ('0x6b9bb36519538e0c073894e964e90172e1c0b41f','0x4200000000000000000000000000000000000006')
and hour::date >= '2024-07-07'
)
,
swaps as (
select
block_timestamp,
tx_hash,
origin_from_address,
contract_address,
token_in,
token_out,
symbol_in,
symbol_out,
pool_name,
platform,
amount_in,
amount_out,
case when block_timestamp::date <= '2024-07-11' then amount_in * p1.price else amount_in_usd end as amount_in_usd_,
case when block_timestamp::date <= '2024-07-11' then amount_out * p2.price else amount_in_usd end as amount_out_usd_
from base.defi.ez_dex_swaps a
left join prices p1 ON date_trunc('hour', block_timestamp) = p1.hour and a.symbol_in = p1.symbol
left join prices p2 ON date_trunc('hour', block_timestamp) = p2.hour and a.symbol_out = p2.symbol
where token_in = '0x6b9bb36519538e0c073894e964e90172e1c0b41f'
or token_out = '0x6b9bb36519538e0c073894e964e90172e1c0b41f'
and block_timestamp::date >= '2024-07-07'
)
select
date_trunc('{{granularity}}', block_timestamp) as date,
QueryRunArchived: QueryRun has been archived