primo_dataTop 10 Profitable NFT Traders
    Updated 2022-07-15
    -- Accounts for 95% of NFT tranasctions
    with nft_transactions AS
    (
    Select tx.*, nft.from_address, nft.to_address, nft.amount_usd
    from
    (
    -- NFT Transaction
    select date(block_timestamp) dt, tx_id
    from flipside_prod_db.polygon.transactions
    where date(block_timestamp) >= date('2021-06-01')
    and to_label_type = 'nft'
    and success = TRUE
    ) tx
    inner join
    (
    -- NFT Transfer
    select tx_id, from_address, to_address, amount_usd
    from flipside_prod_db.polygon.udm_events
    where date(block_timestamp) >= date('2021-06-01')
    and from_address != '0xf715beb51ec8f63317d66f491e37e7bb048fcc2d'
    and to_address != '0xf715beb51ec8f63317d66f491e37e7bb048fcc2d'
    and amount_usd > 0
    ) nft
    on tx.tx_id = nft.tx_id
    )

    select addr, sum(money) total_gains
    from
    (
    select from_address addr, (-amount_usd) money
    from nft_transactions

    union ALL

    select to_address, amount_usd money
    from nft_transactions
    Run a query to Download Data