djebril2023-08-25 07:10 PM
Updated 2023-08-25
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
pricet as (
select
hour::date as date,
token_address,
avg(price) as usdprice
from ethereum.core.fact_hourly_token_prices
group by 1,2
)
,
deposits as (
select
tx_hash,
block_timestamp,
amount_deposited*usdprice as amount_usd,
symbol,
'Deposit' as type,
depositor as user
from ethereum.maker.ez_deposits a
join pricet on pricet.token_address = token_deposited and date = date_trunc('day', block_timestamp)
where TX_STATUS = 'SUCCESS'
)
,
withdrawals as (
select
tx_hash,
block_timestamp,
amount_withdrawn*usdprice as amount_usd,
symbol,
'Withdrawal' as type,
withdrawer as user
from ethereum.maker.ez_withdrawals a
join pricet on pricet.token_address = token_withdrawn and date = date_trunc('day', block_timestamp)
Run a query to Download Data