SpiltadavidAverage Sales volume ($USD) - Daily Visual
    Updated 2022-10-24
    with Price as (
    select
    date_trunc('day', TIMESTAMP) as date,
    avg (price_usd) as price
    from
    flow.core.fact_prices
    where
    source = 'coinmarketcap'
    and symbol = 'FLOW'
    group by
    1
    ),
    Data as (
    select
    NFTs_Sales.block_timestamp as sale_day,
    buyer,
    nft_id,
    case
    when currency = 'A.1654653399040a61.FlowToken' then Price.price * NFTs_Sales.price
    else NFTs_Sales.price
    end as price
    from
    flow.core.ez_nft_sales NFTs_Sales
    join Price on (
    date_trunc('day', NFTs_Sales.block_timestamp) = price.date
    )
    where
    nft_collection ilike 'A.329feb3ab062d289.RaceDay_NFT'
    and tx_succeeded = 'TRUE'
    )
    select
    sum (price) as "Total Sales Volume ($USD)",
    sum (price) / count(DISTINCT (date_trunc('day', sale_day :: date))) as "Average Sales volume ($USD) - Daily",
    sum (price) / count(DISTINCT (date_trunc('week', sale_day :: date))) as "Average Sales volume ($USD) - Weekly",
    sum (price) / count(DISTINCT (date_trunc('month', sale_day :: date))) as "Average Sales volume ($USD) - Monthly",
    count (distinct buyer) as "Total Unique Buyers",
    Run a query to Download Data