Moetp DIST
Updated 2024-03-18
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 price as (
select
HOUR :: Date as day,
avg(PRICE) as price
from
ethereum.price.ez_hourly_token_prices
where
token_address ilike '0x576e2BeD8F7b46D34016198911Cdf9886f78bea7'
group by
1
),
mid as (
select
a.*,
case
when amount_out_usd is null then amount_out * c.price
else amount_out_usd
end as buy_usd
from
ethereum.defi.ez_dex_swaps a
left outer join price c on a.BLOCK_TIMESTAMP :: date = c.day
where
token_out ilike '0x576e2BeD8F7b46D34016198911Cdf9886f78bea7'
and amount_out_usd is not null
and amount_out_usd > 0
and block_timestamp :: date >= CURRENT_DATE - 90
),
middle as (
select
tx_hash,
sender as swapper,
buy_usd as USD_Volume
from
mid
)
select
QueryRunArchived: QueryRun has been archived