amirrzDeposit vs Withdraw amount on MakerDAO
    Updated 2022-09-17
    with Deposits as ( select
    date_trunc('week', block_timestamp) as week,
    sum(amount_deposited) as eth_amount,
    sum(amount_deposited) * avg(price) as eth_amount_usd,
    count(distinct TX_HASH) as deposit_txs,
    count(distinct DEPOSITOR) as Depositors
    from ethereum.maker.ez_deposits a join ethereum.core.fact_hourly_token_prices b
    on a.block_timestamp::date = b.hour::date
    where a.symbol = 'WETH'
    and b.symbol = 'WETH'
    and week >= current_date - 90
    and week < CURRENT_DATE
    group by 1),

    Withdraws as ( select
    date_trunc('week', block_timestamp) as week,
    sum(amount_withdrawn) as eth_amount,
    sum(amount_withdrawn) * avg(price) as eth_amount_usd,
    count(distinct TX_HASH) as withdraw_txs,
    count(distinct WITHDRAWER) as Withdrawers
    from ethereum.maker.ez_withdrawals a join ethereum.core.fact_hourly_token_prices b
    on a.block_timestamp::date = b.hour::date
    where a.symbol = 'WETH'
    and b.symbol = 'WETH'
    and week >= current_date - 90
    and week < CURRENT_DATE
    group by 1)
    select
    D.week as weeks,
    D.eth_amount AS Deposit_eth_amount,
    W.eth_amount AS Withdraw_eth_amount,
    D.eth_amount - W.eth_amount as Net_eth_amount,
    W.withdraw_txs AS Withdraw_TXs,
    D.deposit_txs AS deposit_txs,
    W.Withdrawers,
    Run a query to Download Data