Elprognerd1 daily sales copy
    Updated 2023-03-18
    WITH
    price_t AS (
    SELECT
    recorded_hour::date as date1,
    AVG(close) as price
    FROM
    solana.core.fact_token_prices_hourly
    WHERE
    SYMBOL = 'SOL'
    GROUP BY
    1
    )
    SELECT
    BLOCK_TIMESTAMP::date as date,
    'Tensor' as market1,
    COUNT(distinct TX_ID) as "Number of Sales",
    SUM("Number of Sales") OVER (
    ORDER BY
    date
    ) as "Cumulative Number of NFT sales",
    SUM(SALES_AMOUNT * price) as "NFT Volume in USD",
    AVG(SALES_AMOUNT * price) as "Average Daily Sold Volume",
    SUM("NFT Volume in USD") OVER (
    ORDER BY
    date
    ) as "Cumulative Volume of NFT Sales",
    COUNT(distinct PURCHASER) as "Number of Daily Buyers",
    COUNT(distinct SELLER) as "Number of Daily Sellers"
    FROM
    solana.core.fact_nft_sales x
    JOIN price_t y ON x.BLOCK_TIMESTAMP::date = y.date1
    WHERE
    SUCCEEDED = 'true' AND BLOCK_TIMESTAMP>= '2023-01-01'
    AND MARKETPLACE = 'tensorswap'
    GROUP BY
    1,
    Run a query to Download Data