Query editor
-- WSOLAddress: 'So11111111111111111111111111111111111111112'-- FeeWallet: 'AVUCZyuT35YSuj4RH7fwiyPu82Djn2Hfg7y2ND2XcnZH'-- FirstTradeTimestamp: TIMESTAMP '2024-01-08'WITHbotTradesWithFees AS (SELECTdate_trunc('day', block_time) AS block_date,type,'Solana' AS blockchain,amount_usd,fee_usd,fee_token_amount,fee_token_symbol,user,project_contract_address,tx_id AS tx_hashFROMquery_3817700 -- Photon Solana TradesWHEREisLastTradeInTransaction = true -- This prevents over counting for multi-hop trades and excludes tax distributions),firstUserOccurrences AS (SELECTuser,MIN(block_date) AS firstTradeDateFROMbotTradesWithFeesGROUP BYuser)SELECTblock_date,SUM(amount_usd) AS totalVolumeUSD,COUNT(DISTINCT (botTradesWithFees.user)) AS numberOfUsers,COALESCE(COUNT(DISTINCT (firstUserOccurrences.user)), 0) AS numberOfNewUsers,-- VolumeSUM(IF(blockchain = 'Solana', amount_usd, 0)) AS solanaVolumeUSD,-- UsersCOUNT(DISTINCT (IF(blockchain = 'Solana',botTradesWithFees.user,NULL))) AS solanaNumberOfUsers,-- FeesSUM(fee_usd) AS feesUSD,SUM(IF(fee_token_symbol = 'SOL', fee_token_amount, 0)) AS feesSOL,COUNT(DISTINCT (botTradesWithFees.user)) - COALESCE(COUNT(DISTINCT (firstUserOccurrences.user)), 0) AS numberOfReturningUsers,COUNT(DISTINCT (tx_hash)) AS numberOfTrades,COUNT(DISTINCT (project_contract_address)) AS numberOfPairs,SUM(IF("type" = 'Buy', amount_usd, 0)) AS buyVolumeUSD,SUM(IF("type" = 'Sell', amount_usd, 0)) AS sellVolumeUSD,SUM(COALESCE(COUNT(DISTINCT (firstUserOccurrences.user)), 0)) OVER (ORDER BYblock_date