StangFASTdaily - [ NFTs ]
    Updated 2023-07-05
    -- forked from daily - overview @ https://flipsidecrypto.xyz/edit/queries/287d1015-40f6-4ad1-b5f9-ddeea8403383

    with
    avax_price AS
    (
    SELECT
    date_trunc( '{{period}}' , a.hour ) AS day
    , avg( a.price ) AS price
    FROM
    avalanche.core.fact_hourly_token_prices a
    WHERE
    a.symbol = 'WAVAX'
    GROUP BY 1
    ORDER BY 1 DESC
    )
    SELECT
    date_trunc( '{{period}}' , a.block_timestamp ) AS " Day "

    , count( DISTINCT a.from_address ) AS " Active users "
    , count( DISTINCT a.tx_hash ) AS " Transaction count "
    , sum( d.amount_usd ) AS " USD volume "
    , sum( a.tx_fee * c.price ) AS " Fees paid "

    , b.project_name AS " NFT "

    , sum( " Active users " ) over ( partition BY " NFT " ORDER BY " Day " ASC ) AS " Total of Active users "
    , sum( " Transaction count " ) over ( partition BY " NFT " ORDER BY " Day " ASC ) AS " Total of Transaction count "
    , sum( " USD volume " ) over ( partition BY " NFT " ORDER BY " Day " ASC ) AS " Total of USD volume "
    , sum( " Fees paid " ) over ( partition BY " NFT " ORDER BY " Day " ASC ) AS " Total of Fees paid "

    FROM
    avalanche.core.fact_transactions a
    JOIN
    avalanche.core.dim_labels b
    ON a.to_address = b.address
    JOIN
    Run a query to Download Data