CoinConverseStablecoins on Kashi compare borrowing and lending
    Updated 2022-08-31
    select block_timestamp::date as dt, count(distinct tx_hash) as num_txs, sum(amount_usd) as deposit_amount, 'Borrowing' as activity
    from ethereum.sushi.ez_borrowing
    where action = 'Borrow' and block_timestamp::date > current_date - 30 and collateral_symbol in ('USDC', 'USDT', 'DAI') and amount_usd > 0
    group by 1
    union all
    select block_timestamp::date as dt, count(distinct tx_hash) as num_txs, sum(amount_usd) as deposit_amount, 'Borrowing' as activity
    from polygon.sushi.ez_borrowing
    where action = 'Borrow' and block_timestamp::date > current_date - 30 and collateral_symbol in ('USDC', 'USDT', 'DAI') and amount_usd > 0
    group by 1
    union all
    select block_timestamp::date as dt, count(distinct tx_hash) as num_txs, sum(amount_usd) as deposit_amount, 'Lending' as activity
    from ethereum.sushi.ez_lending
    where action = 'Deposit' and block_timestamp::date > current_date - 30 and symbol in ('USDC', 'USDT', 'DAI') and amount_usd > 0
    group by 1
    union all
    select block_timestamp::date as dt, count(distinct tx_hash) as num_txs, sum(amount_usd) as deposit_amount, 'Lending' as activity
    from polygon.sushi.ez_lending
    where action = 'Deposit' and block_timestamp::date > current_date - 30 and symbol in ('USDC', 'USDT', 'DAI') and amount_usd > 0
    group by 1
    Run a query to Download Data