adriaparcerisaseth derivatives 7: swaps aETH
    Updated 2022-09-13
    WITH
    swaps_in as (
    select
    trunc(block_timestamp,'month') as months,
    sum(amount_in) as amount_in,
    count(distinct tx_hash) as swaps_in
    from ethereum.core.ez_dex_swaps
    where symbol_in ='aETH'
    group by 1
    ),
    swaps_out as (
    select
    trunc(block_timestamp,'month') as months,
    sum(amount_out) as amount_out,
    count(distinct tx_hash) as swaps_out
    from ethereum.core.ez_dex_swaps
    where symbol_out ='aETH'
    group by 1
    )
    SELECT
    x.months,
    amount_in,
    amount_out*(-1) as amount_outs,
    amount_in-amount_out as net_amount,
    swaps_in,
    swaps_out*(-1) as swaps_outs,
    swaps_in-swaps_out as net_swaps
    from swaps_in x
    left join swaps_out y on x.months=y.months
    order by 1 asc

    Run a query to Download Data