Query editor
WITH activity AS (SELECT evt_block_date AS day, 'NFT Buy' AS side, buyer AS user_address, 1 AS trades, CAST("tokensIn" AS double) / 1e18 AS stonkbroker_volume, CAST("ethFeePaid" AS double) / 1e18 AS eth_fees, CAST("boosterShare" AS double) / 1e18 AS booster_eth, CAST("protocolShare" AS double) / 1e18 AS protocol_ethFROM stonkbrokers_robinhood.stonknftammvault_evt_nftbought WHERE evt_block_date >= DATE '2024-01-01'UNION ALLSELECT evt_block_date, 'NFT Sell', seller, 1, CAST("tokensOut" AS double) / 1e18, CAST("ethFeePaid" AS double) / 1e18, CAST("boosterShare" AS double) / 1e18, CAST("protocolShare" AS double) / 1e18FROM stonkbrokers_robinhood.stonknftammvault_evt_nftsold WHERE evt_block_date >= DATE '2024-01-01')SELECT day, side, SUM(trades) AS trades, COUNT(DISTINCT user_address) AS traders, SUM(stonkbroker_volume) AS stonkbroker_volume, SUM(eth_fees) AS eth_fees, SUM(booster_eth) AS booster_eth, SUM(protocol_eth) AS protocol_eth FROM activity GROUP BY 1,2 ORDER BY 1,2