StangFAST02 - collections
    -- forked from 01 - overview chart @ https://flipsidecrypto.xyz/edit/queries/b19dde6e-0fa8-4ede-b496-b87d2492f216

    --- magic eden v2
    --- tensorswap

    with

    sol_price AS
    (
    SELECT
    date_trunc( 'day' , a.recorded_hour ) AS day
    , avg( a.close ) AS price
    , a.symbol AS token
    FROM
    solana.core.fact_token_prices_hourly a
    WHERE
    a.symbol = 'SOL'
    GROUP BY 1 , 3
    ORDER BY 1 DESC
    )


    SELECT
    date_trunc( '{{period}}' , a.block_timestamp ) AS "date"

    , count( DISTINCT a.purchaser ) AS "buyers"
    , count( DISTINCT a.seller ) AS "seller"
    , count( DISTINCT a.tx_id ) AS "transaction"
    , sum( a.sales_amount * c.price ) AS "usd volume"

    , case
    when initcap( split( b.label , ' ' ) [1] ) IS NULL then 'Claynosaurz'
    when initcap( split( b.label , ' ' ) [1] ) = 'Call' then 'Claynosaurz : The Call of Saga'
    when initcap( split( b.label , ' ' ) [1] ) = 'Claymaker' then 'Claynosaurz : Claymaker'
    when initcap( split( b.label , ' ' ) [1] ) = 'Clay' then 'Claynosaurz : Clay'
    when initcap( split( b.label , ' ' ) [1] ) = 'Gigantic' then 'Gigantic Egg'
    Run a query to Download Data