ArioBase DEXs Active users-Selected DEX
    Updated 2024-04-09
    -- forked from Base DEXs Active users @ https://flipsidecrypto.xyz/edit/queries/cf8f0c8f-4cb9-4631-835c-9087b8db2f4a

    with twenty_four as (
    select
    count(distinct ORIGIN_FROM_ADDRESS) as "# 24h Users"
    from base.defi.ez_dex_swaps
    where block_timestamp >= current_date - interval '24 hour'
    and platform = '{{DEX}}'
    ),
    thirty_days as (
    select
    date_trunc(day, block_timestamp) as day,
    count(distinct ORIGIN_FROM_ADDRESS) as "30D users",
    avg("30D users") over(order by day rows between 29 preceding and current row) as "# of Users - MA 30d"
    from base.defi.ez_dex_swaps
    where 1=1
    and platform = '{{DEX}}'
    group by 1
    order by day DESC
    limit 1
    )
    select
    "# 24h Users",
    "# of Users - MA 30d",
    ("# 24h Users" - "# of Users - MA 30d") / "# of Users - MA 30d" * 100 as "24h Growth"
    from twenty_four, thirty_days


    QueryRunArchived: QueryRun has been archived