DiamondNFLAD Sales/Buys 2023
    Updated 2023-05-08
    with
    flowpricet as (
    select
    RECORDED_HOUR::date as date1,
    avg(close) as flowprice
    from
    flow.core.fact_hourly_prices
    where
    TOKEN = 'Flow'
    and PROVIDER = 'coinmarketcap'
    group by
    1
    )
    select
    block_timestamp::date as date,
    count(distinct tx_id) as Sales_Count,
    count(distinct nft_id) as Tokens_Count,
    count(distinct buyer) as Buyers_Count,
    count(distinct seller) as Sellers_Count,
    count(distinct marketplace) as Markets_Count,
    sum(
    case
    when currency = 'A.ead892083b3e2c6c.FlowUtilityToken' then price * flowprice
    else price
    end
    ) as Total_Sale_Volume,
    avg(price * flowprice) as avg_sale,
    sum(total_sale_volume) over (
    order by
    date
    ) as Cumulative_Volume,
    sum(Sales_Count) over (
    order by
    date
    ) as Cumulative_sales,
    sum(Sellers_Count) over (
    Run a query to Download Data