MasiDaily Net Volume ( Deposit-Withdraw = net_volume )
    Updated 2023-03-01
    --( Deposit-Withdraw = net_volume )

    with deposit as ( select trunc(block_timestamp,'day') as day,
    count(DISTINCT DEPOSITOR_ADDRESS) as count_user,
    count(DISTINCT tx_hash) as count_tx,
    sum(SUPPLIED_USD) as volume_usd,
    avg(SUPPLIED_USD) average_usd
    from ethereum.aave.ez_deposits
    where block_timestamp >= '2023-01-01'
    and SUPPLIED_USD > 0
    group by 1)
    ,
    withdraw as ( select trunc(block_timestamp,'day') as day,
    count(DISTINCT DEPOSITOR_ADDRESS) as count_user,
    count(DISTINCT tx_hash) as count_tx,
    sum(WITHDRAWN_USD) as volume_usd,
    avg(WITHDRAWN_USD) average_usd
    from ethereum.aave.ez_withdraws
    where block_timestamp >= '2023-01-01'
    and WITHDRAWN_USD > 0
    group by 1)

    select a.day,
    a.volume_usd as deposit_volume,
    b.volume_usd as withdraw_volume,
    deposit_volume-withdraw_volume as net_volume
    from deposit a left outer join withdraw b on a.day = b.day
    Run a query to Download Data