boomer77top 5 volume uni
    Updated 2021-08-03
    WITH swap_raw AS (
    SELECT
    date_trunc('week', block_timestamp) as weeks,
    pool_address,
    pool_name,
    CASE WHEN amount0_usd < 0 THEN amount0_usd ELSE amount1_usd END AS swap_usd_amount_out,
    CASE WHEN amount0_usd >= 0 THEN amount0_usd ELSE amount1_usd END AS swap_usd_amount_in
    FROM uniswapv3.swaps
    WHERE amount0_usd IS NOT NULL AND amount1_usd IS NOT NULL
    )
    -- // Only amount in
    SELECT
    weeks,
    pool_address,
    pool_name,
    SUM(ABS(swap_usd_amount_in)) AS swap_volume_usd
    FROM swap_raw
    where weeks = CURRENT_DATE - 7
    GROUP BY 1,2,3
    order by 4 DESC
    limit 5
    Run a query to Download Data