binhachon34. [Easy] The Season of Swapping - Pair with the most swaps
    Updated 2022-01-06
    with address_with_txs as (
    select
    block_timestamp,
    from_address as address,
    from_asset,
    to_asset,
    tx_id
    from
    thorchain.swaps
    where block_timestamp > getdate() - interval'30 days'
    ),
    address_list as (
    select
    address,
    count(tx_id) as number_of_swaps
    from
    address_with_txs
    group by address
    order by number_of_swaps desc
    limit 10
    )
    select
    from_asset,
    to_asset,
    count(tx_id) as number_of_swaps
    from
    address_with_txs
    where address in (select address from address_list)
    group by from_asset, to_asset
    order by number_of_swaps desc

    Run a query to Download Data