Afonso_DiazCopy of Copy of Untitled Query
    Updated 2023-01-22
    with t as (
    select
    count(distinct tx_hash) as swaps_in_count,
    count(distinct sender) as swappers_in_count,
    sum(amount_in_usd) as total_amount_in_usd,
    avg(amount_in_usd) as average_amount_in_usd
    from ethereum.core.ez_dex_swaps
    where event_name = 'Swap'
    and symbol_out = 'WETH'
    and block_timestamp between '{{ start_date }}' and '{{ end_date }}'
    ),

    t2 as (
    select
    count(distinct tx_hash) as swaps_out_count,
    count(distinct sender) as swappers_out_count,
    sum(amount_out_usd) as total_amount_out_usd,
    avg(amount_out_usd) as average_amount_out_usd
    from ethereum.core.ez_dex_swaps
    where event_name = 'Swap'
    and symbol_in = 'WETH'
    and block_timestamp between '{{ start_date }}' and '{{ end_date }}'
    )

    select *,
    average_amount_in_usd - average_amount_out_usd as netflow_volume_usd
    from t join t2
    Run a query to Download Data