MLDZMNeth4
    Updated 2023-04-29
    with deposit as (select
    date_trunc('{{Time_basis}}', BLOCK_TIMESTAMP) as date,
    count(distinct tx_hash) as no_txn,
    count(distinct FROM_ADDRESS) as no_users,
    sum(AMOUNT_USD) as deposit_usd,
    avg(AMOUNT_USD) as average_depsoit

    from ethereum.core.ez_token_transfers
    where TO_ADDRESS= lower('0xef8801eaf234ff82801821ffe2d78d60a0237f97')
    and BLOCK_TIMESTAMP>=current_date-{{Period}}
    group by 1
    ),


    withdraw as (select
    date_trunc('{{Time_basis}}', BLOCK_TIMESTAMP) as date,
    count(distinct tx_hash) as no_txn1,
    count(distinct TO_ADDRESS) as no_users1,
    sum(AMOUNT_USD) as withdraw_usd,
    avg(AMOUNT_USD) as average_withdraw

    from ethereum.core.ez_token_transfers
    where FROM_ADDRESS= lower('0xef8801eaf234ff82801821ffe2d78d60a0237f97')
    and BLOCK_TIMESTAMP>=current_date-{{Period}}
    group by 1
    )



    select
    a.date as date,
    deposit_usd,
    withdraw_usd,
    deposit_usd-withdraw_usd as net_deposit_usd,
    average_depsoit,
    average_withdraw,
    Run a query to Download Data