connorhComp Testing
    Updated 2021-04-20
    WITH borrows AS (

    SELECT
    borrower,
    borrows_contract_symbol AS underlying_symbol,
    sum(loan_amount) AS token_loan_amount,
    sum(loan_amount_usd) AS loan_amount_usd
    FROM compound.borrows
    WHERE block_timestamp >= CURRENT_DATE - 60
    GROUP BY 1,2
    ), repays AS (

    SELECT
    borrower,
    repay_contract_symbol AS underlying_symbol,
    sum(repayed_amount) AS token_repay_amount,
    sum(repayed_amount_usd) AS loan_repay_amount_usd
    FROM compound.repayments
    WHERE block_timestamp >= CURRENT_DATE - 60
    GROUP BY 1,2


    ), liquidations AS (
    SELECT
    borrower,
    liquidation_contract_symbol AS underlying_symbol,
    SUM(liquidation_amount) AS amount_seized,
    SUM(liquidation_amount_usd) AS amount_seized_usd,
    COUNT(DISTINCT liquidator) AS liquidators
    FROM
    compound.liquidations
    WHERE block_timestamp >= CURRENT_DATE - 60
    GROUP BY 1,2

    Run a query to Download Data