elenahooHistoric LTV
    Updated 2021-11-30

    select date_trunc('week', block_timestamp) as date
    --, concat(collateral_token_symbol, '-', debt_token_symbol) as collateral_debt_symbol
    , count(tx_id) as tx_count
    , count(borrower) as borrower_count
    , sum(debt_to_cover_amount_usd) / sum(liquidated_amount_usd) as ltv
    , sum()
    from aave.liquidations
    --where collateral_token_symbol = 'XSUSHI' and debt_token_symbol = 'BUSD'
    --and debt_to_cover_amount_usd is not null and liquidated_amount_usd is not null
    --where block_timestamp::date>current_date-30
    group by 1
    order by date asc


    Run a query to Download Data