SectorDAI Interest Rates
    Updated 2022-05-26
    with AAVE as (
    SELECT
    'AAVE' as Protocol,
    TRUNC(block_hour,'{{Time_Scale}}') AS Date,
    reserve_name,
    avg(borrow_rate_variable*100) 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,
    avg(BORROW_APY*100) AS "Comp_Borrow, Interest Rate (%)"
    FROM flipside_prod_db.compound.market_stats
    WHERE
    --UNDERLYING_SYMBOL IN ('USDC')
    --UNDERLYING_SYMBOL IN ('USDT')
    UNDERLYING_SYMBOL IN ('DAI')
    --UNDERLYING_SYMBOL IN ('WBTC')
    AND date between '{{Start_Date}}' and '{{End_Date}}'
    GROUP BY 1,2, 3
    ORDER BY Date
    )

    Select *
    Run a query to Download Data