emirprince95avg AAVE b&d
Updated 2021-11-10
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
›
⌄
with eth_gas_prices as (
SELECT date_trunc('day', block_timestamp) AS day, AVG(gas_price/1e9) AS gas_price_gwei
FROM ethereum.transactions
where success = 'TRUE'
group by 1)
, borrows as (
select date_trunc('day', block_timestamp) AS day, avg(BORROWED_USD) as average_borrows_in_usd
from aave.borrows
where blockchain = 'ethereum'
group by 1
)
, deposits as (
select date_trunc('day', block_timestamp) AS day, avg(supplied_usd) as average_deposits_in_usd
from aave.deposits
where blockchain = 'ethereum'
group by 1
)
, gb as (select b.*, g.gas_price_gwei from eth_gas_prices g join borrows b on b.day = g.day)
select gb.*, deposits.average_deposits_in_usd from deposits join gb on gb.day = deposits.day
Run a query to Download Data