Alexay---
Updated 2023-04-13Copy Reference Fork
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 date_trunc('day', block_timestamp) as day, sum(issued_tokens) as wbtc, sum(supplied_usd) as usd
from flipside_prod_db.aave.deposits
where --block_timestamp>=CURRENT_DATE-365 and
aave_version='Aave V2' and blockchain='ethereum' and symbol = 'WBTC'
group by day
order by day asc),
withdraws as ( select date_trunc('day', block_timestamp) as day, sum(withdrawn_tokens) as wbtc, sum(withdrawn_usd) as usd
from flipside_prod_db.aave.withdraws
where-- block_timestamp>=CURRENT_DATE-365 and
aave_version='Aave V2' and blockchain='ethereum' and symbol = 'WBTC'
group by day
order by day asc)
select d.day, (d.wbtc - w.wbtc) as supplied_wbtc, (d.usd - w.usd) as supplied_usd,
sum(supplied_wbtc) OVER (ORDER BY d.day asc), sum(supplied_usd) OVER (ORDER BY d.day asc)
from deposits d
full join withdraws w on d.day = w.day
order by d.day asc
Run a query to Download Data