Ali3NDately New and Total Swappers Over Time (Cellana Aptos)
    Updated 2024-12-05
    with timetable as (
    select case when '{{TimeFrame}}' = 'Last 7 Days' then 7
    when '{{TimeFrame}}' = 'Last 30 Days' then 30
    when '{{TimeFrame}}' = 'Last 60 Days' then 60
    when '{{TimeFrame}}' = 'Last 90 Days' then 90
    when '{{TimeFrame}}' = 'Last 180 Days' then 180
    when '{{TimeFrame}}' = 'Last 365 Days' then 365
    when '{{TimeFrame}}' = 'All Time' then 5000
    else 5000 end as timeframe)

    select date_trunc ({{Date_Trunc}},mindate) as date,
    count (distinct swapper) as New_Swappers,
    sum (New_Swappers) over (order by date) as Total_Swappers
    from (
    select swapper,
    min (block_timestamp) as mindate
    from aptos.defi.ez_dex_swaps
    where platform ilike '%cellana%'
    group by 1)
    join timetable where mindate >= CURRENT_DATE - timeframe
    group by 1
    order by 1 desc




    Auto-refreshes every 24 hours
    QueryRunArchived: QueryRun has been archived