adriaparcerisasAptos Dex 3.3
    Updated 2024-12-13
    SELECT
    case when DATE_TRUNC('year', BLOCK_TIMESTAMP) ilike '%2024%' then 2024 when DATE_TRUNC('week', BLOCK_TIMESTAMP) ilike '%2023%' then 2023 else 2022 end AS year,
    SUM(AMOUNT_IN_USD) AS total_volume_usd,
    DATE_TRUNC('day', BLOCK_TIMESTAMP) AS day,
    SUM(total_volume_usd) over (partition by year order by day) as cumulative_volume_usd,
    count(distinct tx_hash) as swaps,
    sum(swaps) over (partition by year order by day) as cumulative_swaps,
    count(distinct swapper) as swappers
    FROM
    aptos.defi.ez_dex_swaps
    where AMOUNT_IN_USD<1e6 and amount_in_usd is not null
    GROUP BY
    year, day
    ORDER BY
    day DESC, year




    QueryRunArchived: QueryRun has been archived