SalehFLOW NFT Ecosystem-marketplace-date
    Updated 2022-09-24
    with lst_price as (
    select
    TOKEN_CONTRACT
    ,TIMESTAMP::date as date1
    ,avg(price_usd) as price_
    from flow.core.fact_prices
    group by 1,2
    )
    ,lst_all as (
    select
    tx_id
    ,BLOCK_TIMESTAMP
    ,CURRENCY
    ,MARKETPLACE
    ,NFT_COLLECTION
    ,NFT_ID
    ,BUYER
    ,SELLER
    ,price as amount
    -- ,p.price_usd as price_usd
    from flow.core.ez_nft_sales s
    -- join lst_price p on p.TOKEN_CONTRACT = s.CURRENCY and p.date = s.BLOCK_TIMESTAMP::date
    where TX_SUCCEEDED=true
    )
    select
    date_trunc(week, block_timestamp)::date as date
    ,split(MARKETPLACE,'.')[2] as market
    ,sum(amount*price_) as amount_usd
    ,count(nft_id) as nft_count
    ,count(DISTINCT buyer) as buyers
    ,count(DISTINCT seller) as sellers
    ,sum(amount_usd) over (partition by market order by date) as growth_amount_usd
    ,sum(nft_count) over (partition by market order by date) as growth_nft_count
    ,sum(buyers) over (partition by market order by date) as growth_buyers
    ,sum(sellers) over (partition by market order by date) as growth_sellers
    from lst_all a
    Run a query to Download Data