drone-mostafamaker copy
Updated 2023-05-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 price as (SELECT
date_trunc ('WEEK',HOUR) as tIME,SYMBOL,
avg (price) as Price
FROM crosschain.core.ez_hourly_prices
GROUP BY 1,2)
SELECT
'Deposit' AS TYPE,
d.SYMBOL,
date_trunc ('week',BLOCK_TIMESTAMP) as date,
count (DISTINCT TX_HASH) as TXN,
count (DISTINCT DEPOSITOR) as Users,
sum (AMOUNT_DEPOSITED * price) as USD
FROM ethereum.maker.ez_deposits d
LEFT JOIN price P on (tIME = date_trunc ('WEEK',BLOCK_TIMESTAMP) and d.SYMBOL = p.SYMBOL)
WHERE TX_STATUS = 'SUCCESS'
GROUP BY 1,2,3
UNION ALL
SELECT
'Withdraw' AS TYPE,
d.SYMBOL,
date_trunc ('week',BLOCK_TIMESTAMP) as date,
count (DISTINCT TX_HASH) * -1 as TXN,
count (DISTINCT WITHDRAWER) * -1 as Users,
sum (AMOUNT_WITHDRAWN * price) * -1 as USD
FROM ethereum.maker.ez_withdrawals d
Run a query to Download Data