Sbhn_NPtop 5 over time
    Updated 2023-03-04
    with top_5 as (SELECT
    pool_name,
    sum(amount_in_usd) as swap_volume_usd
    FROM ethereum.core.ez_dex_swaps
    WHERE platform LIKE 'sushiswap'
    GROUP BY 1
    having swap_volume_usd>0
    ORDER BY 2 DESC
    LIMIT 5)

    select date_trunc('day',block_timestamp) as date,
    pool_name,
    count(DISTINCT tx_hash) as txs,
    count(DISTINCT origin_from_address) as users,
    sum(amount_in_usd) as volume,
    avg(amount_in_usd) as avg_volume
    from ethereum.core.ez_dex_swaps
    where platform like 'sushiswap'
    and pool_name in (select pool_name from top_5)
    and date>= CURRENT_DATE -180
    group by 1,2
    Run a query to Download Data