MrftiTop ten CryptoPunk traders (number of trades)
    Updated 2022-08-31
    WITH
    buy_tbl as(
    WITH
    buy_table as(
    select date_trunc(hour,block_timestamp) as DATE, tx_hash , buyer_address, price_usd, price as buy_price, tokenid
    from ethereum.core.ez_nft_sales
    where project_name in ('cryptopunks', 'Wrapped CryptoPunks V1', 'wrapped cryptopunks')
    and event_type in ('sale','bid_won')
    and buyer_address != '0x0000000000000000000000000000000000000000'
    group by block_timestamp, tx_hash, buyer_address, price_usd, price, tokenid

    ),

    eth_price AS
    (
    select date_trunc(hour,block_timestamp) as DATE2, AVG(AMOUNT_OUT/AMOUNT_IN) as eth_PRICE
    FROM ethereum.sushi.ez_swaps
    WHERE SYMBOL_IN='WETH' AND SYMBOL_OUT='USDC'
    GROUP BY DATE2
    )

    select buyer_address, sum( buy_price*eth_price) as total_buy_usd, count(DISTINCT tx_hash) as total_buy_no
    from buy_table join eth_price on date=date2
    group by buyer_address

    ),
    sell_tbl as (

    WITH
    sell_table as(
    select date_trunc(hour,block_timestamp) as DATE, tx_hash , seller_address, price_usd, price as sell_price, tokenid
    from ethereum.core.ez_nft_sales
    where project_name in ('cryptopunks', 'Wrapped CryptoPunks V1', 'wrapped cryptopunks')
    and event_type in ('sale','bid_won')
    and seller_address != '0x0000000000000000000000000000000000000000'
    group by block_timestamp, tx_hash, seller_address, price_usd, price, tokenid
    Run a query to Download Data