SandeshPercentage of projects in each bracket
    Updated 2022-10-19
    with eth as
    (
    with bracketed as
    (
    select
    *,
    case
    when price between 0 and 0.01 then ' 0 - 0.01 ETH'
    when price between 0.01 and 0.1 then ' 0.01 - 0.1 ETH'
    when price between 0.1 and 1 then ' 0.1 - 1 ETH'
    when price between 1 and 10 then ' 1 - 10 ETH'
    when price >10 then '10+ ETH'
    else 'other'
    end as bracket
    from ethereum.core.ez_nft_sales
    where block_timestamp > current_date - interval ' {{number_of_months}} months'
    )
    select
    'ethereum' as chain,
    bracket,
    count(tx_hash) as number_of_transactions,
    sum(price) as vol,
    100* count(distinct nft_address)/(select count(distinct nft_address) from ethereum.core.ez_nft_sales) as percentage_of_projects,
    100* count(distinct buyer_address)/(select count(distinct buyer_address) from ethereum.core.ez_nft_sales) as percentage_of_buyers
    from bracketed
    where currency_symbol in ('WETH','ETH')
    group by bracket
    order by bracket
    ),
    opti as
    (
    with bracketed as
    (
    select
    *,
    case
    Run a query to Download Data