carlesmontalaALGO NFT TTOLING 1
    Updated 2022-11-12
    with pricet as (
    select block_hour::date as day,
    avg (price_usd) as AlgoPrice
    from algorand.core.ez_price_pool_balances
    group by 1)

    select count (distinct tx_group_id) as Sales_Count,
    count (distinct purchaser) as Purchasers_Count,
    count (distinct collection_name) as Collections_Count,
    count (distinct nft_asset_id) as NFTs_Count,
    sum (total_sales_amount) as Total_ALGO_Volume,
    sum (total_sales_amount*AlgoPrice) as Total_USD_Volume,
    avg (total_sales_amount) as Average_ALGO_Volume,
    avg (total_sales_amount*AlgoPrice) as Average_USD_Volume,
    median (total_sales_amount) as Median_ALGO_Volume,
    median (total_sales_amount*AlgoPrice) as Median_USD_Volume,
    min (total_sales_amount) as Minimum_ALGO_Volume,
    min (total_sales_amount*AlgoPrice) as Minimum_USD_Volume,
    max (total_sales_amount) as Maximum_ALGO_Volume,
    max (total_sales_amount*AlgoPrice) as Maximum_USD_Volume
    from algorand.nft.ez_nft_sales t1 join pricet t2 on t1.block_timestamp::date = t2.day
    where nft_marketplace ilike '{{PLATFORM}}'
    and block_timestamp::date >= CURRENT_DATE - {{DAYS}}
    and total_sales_amount > 0