boomer77AAVE TVL
Updated 2021-08-23
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
›
⌄
with raw as
(select
distinct date_trunc('day', block_hour) as day,
last_value(total_stable_debt_usd) OVER (PARTITION BY day, atoken_address ORDER BY block_hour RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as borrows_stable,
last_value(total_variable_debt_usd) OVER (PARTITION BY day, atoken_address ORDER BY block_hour RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as borrows_variable,
last_value(total_liquidity_usd) OVER (PARTITION BY day, atoken_address ORDER BY block_hour RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as supply,
last_value(total_liquidity_usd - total_variable_debt_usd - total_stable_debt_usd) OVER (PARTITION BY day, atoken_address ORDER BY block_hour RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as tvl
from aave.market_stats
where block_hour > getdate() - interval '6 months'
)
select day, sum(tvl) from raw
group by 1
order by 1 desc
Run a query to Download Data