pouya_22ETH Derivatives - Swaps to average
    Updated 2022-09-13
    with swaps as (select
    date_trunc('week', block_timestamp) as date,
    case
    when token_out = '0x3a3a65aab0dd2a17e3f1947ba16138cd37d08c04' then 'aETH'
    when token_out = '0x9559aaa82d9649c7a7b220e7c461d2e74c9a3593' then 'rETH'
    when token_out = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84' then 'stETH'
    else null
    end as token,
    count(distinct tx_hash) as swaps,
    count(distinct origin_from_address) as swappers,
    sum(amount_out_usd) as volume
    from ethereum.core.ez_dex_swaps
    where amount_out_usd is not null
    and event_name = 'Swap'
    group by 1,2
    having token is not null)

    select
    token,
    avg(swaps) as swaps_avg,
    avg(swappers) as swappers_avg,
    avg(volume) as volume_avg
    from swaps
    group by 1
    Run a query to Download Data