Query editor
WITHbotTradesWithFees AS (SELECTdate_trunc('day', block_time) AS block_date,amount_usd,feeGwei,type,project_contract_address,user,tx_hashFROM/* Unibot Bot Trades */query_2640849WHEREisLastTradeInTransaction = true -- This prevents over counting for multi-hop trades and excludes tax distributions),firstUserOccurrences AS (SELECTuser,MIN(block_date) AS firstTradeDateFROMbotTradesWithFeesGROUP BYuser),UNIBOTTokenPrices AS (SELECTblockTime,closePriceWETH,closePriceUSD,mcapETH,mcapUSD,averageWETHUSDFROM query_2656557),BaseMetrics AS (SELECTbotTradesWithFees.block_date,SUM(amount_usd) AS totalVolumeUSD,COUNT(DISTINCT (botTradesWithFees.user)) AS numberOfUsers,COALESCE(COUNT(DISTINCT (firstUserOccurrences.user)), 0) AS numberOfNewUsers,SUM(IF("type" = 'Buy', amount_usd, 0)) AS buyVolumeUSD,SUM(IF("type" = 'Sell', amount_usd, 0)) AS sellVolumeUSD,SUM(feeGwei) / 1e18 as feesETH,(SUM(feeGwei) / 1e18) * utp.averageWETHUSD as feesUSD,((SUM(feeGwei) / 1e18) * utp.averageWETHUSD) / SUM(amount_usd) as Avefees,(((SUM(feeGwei) / 1e18) * utp.averageWETHUSD) * 365 * .45) / utp.mcapUSD as DiscountRate,COUNT(DISTINCT (tx_hash)) AS numberOfTrades,COUNT(DISTINCT (project_contract_address)) AS numberOfPairs,COUNT(DISTINCT (botTradesWithFees.user)) - COALESCE(COUNT(DISTINCT (firstUserOccurrences.user)), 0) AS numberOfReturningUsers,SUM(COALESCE(COUNT(DISTINCT (firstUserOccurrences.user)), 0)) OVER (ORDER BYbotTradesWithFees.block_date) AS cumulative_numberOfNewUsers,AVG((((SUM(feeGwei) / 1e18) * utp.averageWETHUSD) * 365 * .45) / utp.mcapUSD) OVER (ORDER BY