Kruys-CollinsACX Swap Volume (90Days)
Updated 2024-11-09
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 base as
(
select
block_timestamp:: date as Date
,CASE when token_in = lower('0x44108f0223A3C3028F5Fe7AEC7f9bb2E66beF82F')
then 'sell' else 'buy'
end as Tag
,sum( CASE when tag= 'buy' then amount_in_usd
else amount_in_usd * (-1) end ) as Volume
from ethereum.defi.ez_dex_swaps
where 7 = 7
and block_timestamp >= CURRENT_DATE - 90
and (token_in = lower('0x44108f0223A3C3028F5Fe7AEC7f9bb2E66beF82F')
OR
token_out = lower('0x44108f0223A3C3028F5Fe7AEC7f9bb2E66beF82F')
)
GROUP BY 1,2
ORDER BY 1 ASC
),
net_vol AS (
SELECT
Date
,sum(Volume) as Net_volume
FROM base
group by 1
)
SELECT
b.Date
,Tag
,Volume
,Net_volume/2 as Net_volume
FROM base b
left join net_vol v on b.date = v.date
QueryRunArchived: QueryRun has been archived