mitchperionSidus Hero Sales
    Updated 2023-09-16
    -- forked from Madi / Sales Heroes @ https://flipsidecrypto.xyz/Madi/q/2023-03-23-12-41-am-ircEIQ

    SELECT date_trunc('week', BLOCK_TIMESTAMP) as date,
    --PLATFORM_NAME,
    count(DISTINCT TX_HASH) as tx_count,
    count(DISTINCT TOKENID) as unique_tokens,
    count(DISTINCT SELLER_ADDRESS) as seller, count(DISTINCT BUYER_ADDRESS) as BUYER,
    sum(PRICE_USD) as volume_usd, avg(PRICE_USD) as avg_PRICE_uSD, median(PRICE_USD) as median_PRICE_uSD, max(PRICE_USD) as max_PRICE_uSD, min(PRICE_USD) as min_PRICE_uSD,
    sum(TOTAL_FEES) as total_fees,
    seller/buyer as ratio,
    sum(tx_count) over (order by date asc rows between unbounded preceding and current row) as cum_tx,
    sum(volume_usd) over (order by date asc rows between unbounded preceding and current row) as cum_volume,
    tx_count/buyer as tx_buyer,
    tx_count/seller as tx_seller
    FROM ethereum.core.ez_nft_sales
    WHERE PROJECT_NAME = 'sidus nft heroes' and PRICE_USD > 0
    and EVENT_TYPE = 'sale'
    group by 1--,2


    Run a query to Download Data