CryptoLionbrians3
    Updated 2021-05-18
    WITH liquidations as (
    SELECT
    liquidation_contract_symbol,
    SUM(liquidation_amount_usd) as liquidation_amount
    FROM compound.liquidations
    GROUP BY 1)
    , borrowers as (
    SELECT
    borrows_contract_symbol,
    SUM(loan_amount_usd) as loan_amount
    FROM compound.borrows
    GROUP BY 1)

    SELECT
    liquidation_contract_symbol,
    liquidation_amount,
    loan_amount,
    liquidation_amount/loan_amount*100 as dollar_probability_liquidation
    FROM liquidations
    JOIN borrowers ON borrowers.borrows_contract_symbol=liquidations.liquidation_contract_symbol
    ORDER BY 4 DESC
    Run a query to Download Data