StangFAST03 - Total weekly
    Updated 2023-04-13
    with near_price AS
    (

    SELECT
    date_trunc( 'week' , a.timestamp ) AS date
    , avg( a.price_usd ) AS price
    FROM
    near.core.fact_prices a

    WHERE
    a.symbol = 'wNEAR'

    GROUP BY
    1

    ORDER BY
    1 DESC

    )


    SELECT
    date_trunc( 'week' , a.block_timestamp ) AS day

    , CASE
    when a.tx_receiver LIKE '%mintbase1.near' then 'Mintbase'
    when a.tx_receiver LIKE '%fewandfar.near' then 'Few and Far'
    when a.tx_receiver IN ( 'comic.paras.near' , 'x.paras.near' ) then 'Paras'
    END AS " NFT marketplace "

    , CASE when " NFT marketplace " = 'Paras' then b.price END AS " NEAR price "

    , count( DISTINCT a.tx_hash ) AS total_tx
    , sum( total_tx ) over ( PARTITION BY " NFT marketplace " ORDER BY day ASC ) AS cumulative_total_tx

    Run a query to Download Data