Soheil_MKUntitled Query
    Updated 2022-09-14
    with deposit as (
    select
    BLOCK_TIMESTAMP::date as date,
    sum(amount_deposited) as ETH_amounts,
    sum(ETH_amounts) over (order by date) as cum_ETH_amounts
    from ethereum.maker.ez_deposits
    where symbol = 'WETH'
    and date >= '2022-01-01'
    group by 1
    ),

    withdraw as (
    select
    BLOCK_TIMESTAMP::date as date,
    sum(AMOUNT_WITHDRAWN) as ETH_amounts,
    sum(ETH_amounts) over (order by date) as cum_ETH_amounts
    from ethereum.maker.ez_withdrawals
    where symbol = 'WETH'
    and date >= '2022-01-01'
    group by 1
    )


    select
    a.date,
    a.ETH_amounts as deposited_ETH,
    -b.ETH_amounts as withdrawn_ETH,
    sum(a.ETH_amounts-b.ETH_amounts) over (order by a.date) as cum_total
    from deposit a
    join withdraw b
    on a.date=b.date
    where a.date>='2022-07-01'
    Run a query to Download Data