Query editor
WITH seller_table AS (SELECTseller,fid,fname,SUM(amount_usd) AS total_valueFROM nft.tradesJOIN dune.neynar.dataset_farcaster_fnamesON custody_address = sellerWHEREblock_date > TRY_CAST('2023-01-01' AS DATE) AND blockchain = 'base'GROUP BYseller,fid,fnameORDER BYtotal_value DESC), buyer_table AS (SELECTbuyer,fid,fname,SUM(amount_usd) AS total_valueFROM nft.tradesJOIN dune.neynar.dataset_farcaster_fnamesON custody_address = buyerWHEREblock_date > TRY_CAST('2023-01-01' AS DATE) AND blockchain = 'base'GROUP BYbuyer,fid,fnameORDER BYtotal_value DESC)SELECTbuyer_table.fname,(buyer_table.total_value - COALESCE(seller_table.total_value, 0)) AS net_tradesFROM buyer_tableLEFT JOIN seller_tableON buyer_table.fid = seller_table.fidORDER BYnet_trades DESC