SalehAllDay collection sales statistics-date
    Updated 2024-09-10
    -- forked from AllDay collection sales statistics @ https://flipsidecrypto.xyz/edit/queries/9d08b79c-dd6f-4d39-b504-abee4ad37454
    with lst_price as (
    SELECT
    date_trunc(day,hour) as price_date,
    avg(price) as avg_price
    from flow.price.ez_prices_hourly
    where symbol = 'FLOW'
    group by 1
    )

    ,lst_first_buy as (
    select
    buyer
    ,min(block_timestamp)::date as min_date
    from flow.nft.ez_nft_sales
    group by 1
    )
    ,lst_new_users_list as (
    select
    min_date
    ,count(buyer) as new_users
    from lst_first_buy
    group by 1
    )
    select
    block_timestamp::date as date ,
    new_users,
    ------Activity days---------------------------------------------------------------------
    (
    select count(DISTINCT block_timestamp::date) from flow.nft.ez_nft_sales
    where nft_collection = 'A.e4cf4bdc1751c65d.AllDay'
    and currency= 'A.ead892083b3e2c6c.DapperUtilityCoin'
    and marketplace='A.4eb8a10cb9f87357.NFTStorefront'
    and tx_succeeded = true
    ) as "Activity days",
    QueryRunArchived: QueryRun has been archived