nitsDecentraland Stats
    Updated 2023-04-26
    with sandbox as
    (SELECT
    date(block_timestamp) as day,
    count(DISTINCT tx_hash) as total_txs,
    count(DISTINCT buyer_address) as total_buyers,
    sum(price_usd) as total_amt_usd,
    sum(total_amt_usd) over ( order by day) as cum_amt,
    sum(total_txs) over ( order by day) as cum_txs,
    min(price_usd) as floor_price,
    avg(price_usd) as avg_price,
    max(price_usd) as max_price,
    min(floor_price) over ( order by day rows between {{ma}} preceding and CURRENT row ) as floor_price_moving_avg,
    max(max_price) over ( order by day rows between {{ma}} preceding and CURRENT row) as max_price_moving_avg
    from
    ethereum.core.ez_nft_sales
    where (nft_address ilike '0x5cc5b05a8a13e3fbdb0bb9fccd98d38e50f90c38') and date(block_timestamp) >= CURRENT_DATE - {{n}}
    GROUP by 1
    ),
    decentraland as
    (SELECT
    date(block_timestamp) as day,
    count(DISTINCT tx_hash) as total_txs,
    count(DISTINCT buyer_address) as total_buyers,
    sum(price_usd) as total_amt_usd,
    sum(total_amt_usd) over ( order by day) as cum_amt,
    sum(total_txs) over ( order by day) as cum_txs,
    min(price_usd) as floor_price,
    avg(price_usd) as avg_price,
    max(price_usd) as max_price,
    min(floor_price) over ( order by day rows between {{ma}} preceding and CURRENT row ) as floor_price_moving_avg,
    max(max_price) over ( order by day rows between {{ma}} preceding and CURRENT row) as max_price_moving_avg
    from
    ethereum.core.ez_nft_sales
    where (nft_address ilike '0x959e104e1a4db6317fa58f8295f586e1a978c297' or nft_address ilike '0xf87e31492faf9a91b02ee0deaad50d51d56d5d4d') and date(block_timestamp) >= CURRENT_DATE - {{n}}
    GROUP by 1
    )
    Run a query to Download Data