MLDZMNXAR-com-1
    Updated 2023-01-27
    with tb2 AS (
    select
    RECORDED_HOUR::date as day,
    avg(close) as price_token
    from solana.core.fact_token_prices_hourly where SYMBOL='SOL'
    group by 1)


    select
    Case when marketplace ilike '%magic%' then 'Magic Eden' else marketplace end as marketplaces,
    count(distinct tx_id) as sale_no,
    count(distinct PURCHASER) as buyer_no,
    count(distinct SELLER) as seller_no,
    count(distinct x.MINT) as no_NFTs,
    count(distinct CONTRACT_NAME ) as no_collections,
    sum(SALES_AMOUNT) as volume,
    sum(SALES_AMOUNT*price_token) as volume_usd,
    avg(SALES_AMOUNT*price_token)as average_volume,
    Median(SALES_AMOUNT*price_token) as median_volume,
    min(SALES_AMOUNT*price_token) as floor_price,
    max(SALES_AMOUNT*price_token) as highest_price,
    sale_no/buyer_no as average_buyer,
    sale_no/no_collections as average_sale_per_collcetion,
    volume_USD/no_collections as average_volume_per_collcetion,
    buyer_no/count(distinct date_trunc(day, block_timestamp)) as average_buyer_day,
    volume_USD/count(distinct date_trunc(day, block_timestamp)) as average_volume_day
    from solana.core.fact_nft_sales x join tb2 y on x.BLOCK_TIMESTAMP::date=y.day
    left join solana.core.dim_nft_metadata z on x.mint=z.mint
    where SUCCEEDED='TRUE'
    and SALES_AMOUNT > 0
    group by 1

    Run a query to Download Data