Elprognerd3 - Monthly net volume
    Updated 2023-06-05
    with t1 as(select date_trunc('month',BLOCK_TIMESTAMP) as date,
    'Deposit' as action,
    ISSUED_TOKENS as amount,
    DEPOSITOR_ADDRESS,
    TX_HASH
    FROM ethereum.aave.ez_deposits
    where aave_market = '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9'
    union all
    select date_trunc('month', BLOCK_TIMESTAMP) as date,
    'Withdrawal' as action,
    WITHDRAWN_TOKENS as amount,
    DEPOSITOR_ADDRESS,
    TX_HASH
    FROM ethereum.aave.ez_withdraws
    where aave_market = '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9')

    , t2 as (
    SELECT
    date,
    action,
    -1*sum(amount) as "Total volume"
    from t1
    where action = 'Withdrawal'
    GROUP BY 1, 2
    union all
    SELECT
    date,
    action,
    sum(amount) as "Total volume"
    from t1
    where action = 'Deposit'
    GROUP BY 1, 2
    order by 1, 2)

    SELECT
    date,
    Run a query to Download Data