MLDZMNsec8
    Updated 2023-04-13
    with tb2 as (select
    hour::date as day,
    avg(price) as price_token
    from ethereum.core.fact_hourly_token_prices where SYMBOL = 'WETH'
    group by 1)

    select
    CASE WHEN (PRICE*price_token) <= 20 THEN 'a.below 20'
    WHEN (PRICE*price_token) > 20 and (PRICE*price_token) <=100 THEN 'b.20-100'
    WHEN (PRICE*price_token) > 100 and (PRICE*price_token) <=500 THEN 'c.100-500'
    WHEN (PRICE*price_token) > 500 THEN 'd.above 500'
    END as buckets,
    count(distinct tx_hash) as sale_no,
    count(distinct BUYER_ADDRESS) as buyer_no
    from optimism.core.ez_nft_sales x join tb2 y on x.BLOCK_TIMESTAMP::date=y.day
    left join optimism.core.dim_labels s on x.NFT_ADDRESS=s.ADDRESS
    where PLATFORM_NAME='quixotic'
    and EVENT_TYPE='sale'
    and CURRENCY_SYMBOL='ETH'
    group by 1
    Run a query to Download Data