Eman-RazDaily Statistical Data: Swap Volume ($USD)
    Updated 2023-04-13
    with table1 as (with tab1 as (select date_trunc('day',block_timestamp) as date, sum(amount_in) as volume, sum(amount_in_usd) as volume_usd,
    count(distinct tx_hash) as tx_count, count(distinct origin_from_address) as user_count, 'selling' as action
    from ethereum.core.ez_dex_swaps
    where token_in='0x0f5d2fb29fb7d3cfee444a200298f468908cc942' and block_timestamp::date>='2021-01-01'
    group by 1
    order by 1),
    tab2 as (select date_trunc('day',block_timestamp) as date, sum(amount_out) as volume, sum(amount_in_usd) as volume_usd,
    count(distinct tx_hash) as tx_count, count(distinct origin_from_address) as user_count, 'buying' as action
    from ethereum.core.ez_dex_swaps
    where token_out='0x0f5d2fb29fb7d3cfee444a200298f468908cc942' and block_timestamp::date>='2021-01-01'
    group by 1
    order by 1)

    select * from tab1
    union ALL
    select * from tab2)
    select action, avg(volume_usd) as "Average", median(volume_usd) as "Median", max(volume_usd) as "Maximum", min(volume_usd) as "Minimum"
    from table1
    group by 1
    Run a query to Download Data