KaskoazulSHUFL TOP 10 NFT COLLECTIONS
    Updated 2022-11-10
    with nft_sales_timeframe as (
    select s.*,
    p.price_usd,
    total_sales_amount*p.price_usd as total_sales_amount_usd,
    case array_size(split(nft_asset_name, ' '))
    when 4 then lower(concat_ws('_',split_part(nft_asset_name, ' ', 1),split_part(nft_asset_name, ' ', 2), split_part(nft_asset_name, ' ', 3)))
    when 3 then lower(concat_ws('_',split_part(nft_asset_name, ' ', 1),split_part(nft_asset_name, ' ', 2)))
    when 2 then lower(split_part(nft_asset_name, ' ', 1))
    when 1 then nft_asset_name
    end as alternate_name,
    upper(nvl(collection_name, alternate_name)) as collection
    from algorand.nft.ez_nft_sales s
    left join algorand.defi.ez_price_pool_balances p
    on date_trunc('hour', s.block_timestamp) = p.block_hour
    where s.block_timestamp > CURRENT_DATE - 1 -{{Last_number_of_days}}
    ),

    -- rand_top_collections as (
    -- select collection,
    -- count(distinct tx_group_id) as sales,
    -- --count(distinct purchaser) as purchasers,
    -- round(sum(total_sales_amount)) as volume,
    -- --round(sum(total_sales_amount_usd)) as volume_usd,
    -- round(avg(total_sales_amount)) as average_price--,
    -- --row_number () over (order by volume desc) as rank
    -- from nft_sales_timeframe
    -- where nft_marketplace = 'rand gallery'
    -- group by 1
    -- order by volume desc
    -- limit 10
    -- ),

    -- algoxnft_top_collections as (
    -- select collection,
    -- count(distinct tx_group_id) as sales,
    -- --count(distinct purchaser) as purchasers,
    Run a query to Download Data