StangFASToverall of marketplace that sells NFT projects on Flow blockchain
    Updated 2023-06-02
    -- forked from overall of NFT projects on Flow blockchain @ https://flipsidecrypto.xyz/edit/queries/2ec94f6b-e977-4cde-a6ea-1d88d9337c22

    -- forked from 01 @ https://flipsidecrypto.xyz/edit/queries/cca585a7-63d6-4527-b0dd-5eb520b29d07

    with

    flow_price AS
    (
    SELECT
    date_trunc( 'day' , a.recorded_hour ) AS day
    , avg( a.close ) AS price
    FROM
    flow.core.fact_hourly_prices a
    WHERE
    a.token = 'Flow'
    GROUP BY
    1
    ORDER BY
    1 DESC
    )

    SELECT

    c.contract_name AS marketplace

    , concat( to_char( cast( count( DISTINCT a.buyer ) AS decimal( 30 , 0 ) ), '9,999,999,999,999') ) AS buyers
    , concat( to_char( cast( count( DISTINCT a.seller ) AS decimal( 30 , 0 ) ), '9,999,999,999,999') ) AS sellers
    , concat( to_char( cast( count( DISTINCT a.nft_id ) AS decimal( 30 , 0 ) ), '9,999,999,999,999') ) AS nfts
    , concat( to_char( cast( count( DISTINCT a.tx_id ) AS decimal( 30 , 0 ) ), '9,999,999,999,999') ) AS transactions
    , concat( '$' , to_char( cast( max( a.price * b.price ) AS decimal( 30 , 0 ) ), '9,999,999,999,999') ) AS max_price
    , concat( '$' , to_char( cast( avg( a.price * b.price ) AS decimal( 30 , 0 ) ), '9,999,999,999,999') ) AS avg_price
    , CASE
    when min( a.price * b.price ) >= 1 then concat( '$' , to_char( cast( min( a.price * b.price ) AS decimal( 30 , 0 ) ), '9,999,999,999,999' ) )
    when min( a.price * b.price ) < 1 then concat( '$' , to_char( cast( min( a.price * b.price ) AS decimal( 30 , 3 ) ), '9,999,999,999,999.000') )
    END
    AS min_price
    Run a query to Download Data