Ali3NDately Swaps Overview 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}},block_timestamp) as date,
    count (distinct tx_hash) as Swaps,
    count (distinct swapper) as Active_Swappers,
    sum (coalesce (amount_out_usd,amount_in_usd)) As Volume,
    avg (coalesce (amount_out_usd,amount_in_usd)) as Average_Volume,
    sum (Swaps) over (order by date) as Total_Swaps,
    sum (Volume) over (order by date) as Total_Volume
    from aptos.defi.ez_dex_swaps t1 join timetable
    where platform ilike '%cellana%'
    and block_timestamp >= CURRENT_DATE - timeframe
    and token_in not in ('0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12','0x4def3d3dee27308886f0a3611dd161ce34f977a9a5de4e80b237225923492a2a::coin::T','0x63be1898a424616367e19bbd881f456a78470e123e2770b5b5dcdceb61279c54::movegpt_token::MovegptCoin')
    and token_out not in ('0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12','0x4def3d3dee27308886f0a3611dd161ce34f977a9a5de4e80b237225923492a2a::coin::T','0x63be1898a424616367e19bbd881f456a78470e123e2770b5b5dcdceb61279c54::movegpt_token::MovegptCoin')
    group by 1
    order by 1 desc

    /*select *
    from aptos.defi.ez_dex_swaps
    where platform ilike '%cellana%'
    and amount_out_Usd >0
    and token_in not in ('0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12','0x4def3d3dee27308886f0a3611dd161ce34f977a9a5de4e80b237225923492a2a::coin::T')
    and token_out not in ('0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12','0x4def3d3dee27308886f0a3611dd161ce34f977a9a5de4e80b237225923492a2a::coin::T')

    order by amount_out_usd desc

    limit 1000*/
    Auto-refreshes every 24 hours
    QueryRunArchived: QueryRun has been archived