sepehrmhz8Untitled Query
    WITH lendings as (
    select
    date(block_timestamp) as date,
    count(distinct ORIGIN_FROM_ADDRESS) as lenders,
    case when sum(amount) is null then 0 else sum(AMOUNT_USD) end as volume_lending
    from ethereum.sushi.ez_lending
    where ethereum.sushi.ez_lending.action = 'Deposit'
    group by 1
    ),
    borrowings as (
    select
    date(block_timestamp) as date,
    count(distinct ORIGIN_FROM_ADDRESS) as borrowers,
    sum(AMOUNT_USD) as volume_borrowing
    from ethereum.sushi.ez_borrowing
    where ethereum.sushi.ez_borrowing.action = 'Borrow'
    group by 1
    )
    SELECT
    ln.date,
    lenders,
    borrowers,
    lenders + borrowers as lendander_brrowers,
    volume_lending,
    volume_borrowing,
    volume_lending + volume_borrowing as avg_volume_both
    from borrowings bw
    left join lendings ln on bw.date = ln.date
    order by 1 asc