KaskoazulJoined Swaps-wallets
    Updated 2022-04-19
    WITH ASSETS AS (
    select swapper as wallet,
    count(distinct swap_from_asset_id) as number_of_assets
    from algorand.swaps
    where block_timestamp >= '2022-01-01'
    and swap_from_amount >= 0
    group by wallet--, type
    order by number_of_assets desc
    ),

    SWAPS AS (
    select swapper as wallet,
    count(distinct tx_group_id) as swaps,
    PERCENT_RANK() OVER(ORDER BY swaps desc) AS Percent_Rank
    from algorand.swaps
    where block_timestamp >= '2022-01-01'
    and swap_from_amount >= 0
    group by wallet--, type
    order by swaps desc
    )

    select a.wallet,
    s.swaps,
    a.number_of_assets,
    s.swaps/a.number_of_assets as swaps_per_asset
    from ASSETS a
    inner join SWAPS s
    on a.wallet = s.wallet
    where swaps > 1000
    order by swaps desc


    Run a query to Download Data