0xaimanAverage volume per transaction per address, Deposit vs Withdrawal
    Updated 2023-03-08
    (select *, case when a2 is not null then 'Average Deposit Volume per txn per address' end as note from (with dep as (with a as (select tx_hash
    from ethereum.core.fact_event_logs
    where contract_address='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' and
    event_name='Deposit' and
    ORIGIN_TO_ADDRESS = '0x3b968d2d299b895a5fcf3bba7a64ad0f566e6f88'),

    c as (select origin_from_address as depositor, b.tx_hash, amount from ethereum.core.ez_eth_transfers b
    inner join a on b.tx_hash=a.tx_hash)

    select depositor, avg(amount) as avg_vol_per_deposit
    from c
    group by 1


    ),

    wdr as (with a as (select tx_hash
    from ethereum.core.fact_event_logs
    where contract_address='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' and
    event_name='Withdrawal' and
    ORIGIN_TO_ADDRESS = '0x3b968d2d299b895a5fcf3bba7a64ad0f566e6f88'),

    c as (select origin_from_address as depositor, b.tx_hash, amount from ethereum.core.ez_eth_transfers b
    inner join a on b.tx_hash=a.tx_hash)

    select depositor, avg(amount) as avg_vol_per_withdrawal
    from c
    group by 1


    )

    select avg(avg_vol_per_deposit) as a2
    Run a query to Download Data