SectorUSDC Interest Rates
Updated 2022-05-26
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
›
⌄
-- add: Case "Borrow, Interest Rate (%)" = then null end -to smooth graph
with AAVE as (
SELECT
'AAVE' as Protocol,
TRUNC(block_hour,'{{Time_Scale}}') AS Date,
reserve_name,
case when avg(borrow_rate_variable*100) = 0 then NULL
else avg(borrow_rate_variable*100) end AS "Borrow, Interest Rate (%)"
FROM aave.market_stats
WHERE blockchain = 'ethereum'
AND aave_version = 'Aave V2'
AND reserve_name IN ('USDC')
--AND reserve_name IN ('USDT')
--AND reserve_name IN ('DAI')
--AND reserve_name IN ('WBTC')
AND date between '{{Start_Date}}' and '{{End_Date}}'
GROUP BY 1,2, 3
ORDER BY Date
),
Compound as (
SELECT
'Compound' as Protocol,
TRUNC(block_hour,'{{Time_Scale}}') AS Date,
UNDERLYING_SYMBOL,
case when avg(BORROW_APY*100) = 0 then NULL
else avg(BORROW_APY*100) end AS "Comp_Borrow, Interest Rate (%)"
FROM flipside_prod_db.compound.market_stats
WHERE UNDERLYING_SYMBOL IN ('USDC')
--AND UNDERLYING_SYMBOL IN ('USDT')
--AND UNDERLYING_SYMBOL IN ('DAI')
--AND UNDERLYING_SYMBOL IN ('WBTC')
AND date between '{{Start_Date}}' and '{{End_Date}}'
GROUP BY 1,2, 3
ORDER BY Date
Run a query to Download Data