freemartianDeposit & Withdraw
Updated 2023-04-13
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
›
⌄
with deposits as (
SELECT
block_timestamp::date as TIME,
count(DISTINCT depositor_address) as depositor,
sum(supplied_usd) as deposit_amount
FROM flipside_prod_db.aave.deposits
WHERE aave_token = '0xffc97d72e13e01096502cb8eb52dee56f74dad7b'
and block_timestamp > CURRENT_DATE - 365
group by TIME),
withdraws as (
SELECT
block_timestamp::date as TIME,
count(DISTINCT depositor_address) as withdrawer,
sum(withdrawn_usd) as withdrawn_amount
FROM flipside_prod_db.aave.withdraws
WHERE aave_token = '0xffc97d72e13e01096502cb8eb52dee56f74dad7b'
and block_timestamp > CURRENT_DATE - 365
group by TIME
)
select (deposit_amount - withdrawn_amount) as daily_sum, sum(daily_sum) over (order by d.TIME) as cum_sum,
deposit_amount, withdrawn_amount, d.TIME
from deposits d inner join withdraws w on w.TIME = d.TIME
Run a query to Download Data