Query editor
WITHtrades AS (SELECT*FROM/* Stars Arena Trades table*/query_3127897),firstUserOccurrences AS (SELECTtrader,MIN(trades.block_date) AS firstTradeDateFROMtradesGROUP BYtrader),statsByDay AS (SELECTblock_date,SUM(volumeUSD) AS volumeUSD,SUM(volumeAVAX) AS volumeAVAX,COUNT(DISTINCT (trades.trader)) AS numberOfTraders,COALESCE(COUNT(DISTINCT (firstUserOccurrences.trader)), 0) AS numberOfNewTraders,COUNT(DISTINCT (trades.trader)) - COALESCE(COUNT(DISTINCT (firstUserOccurrences.trader)), 0) AS numberOfReturningTraders,SUM(feeUSD) AS feesUSD,SUM(feeAVAX) AS feesAVAX,SUM(IF(type = 'Buy', volumeUSD, NULL)) AS buyVolumeUSD,SUM(IF(type = 'Buy', volumeAVAX, NULL)) AS buyVolumeAVAX,SUM(IF(type = 'Sell', volumeUSD, NULL)) AS sellvolumeUSD,SUM(IF(type = 'Sell', volumeAVAX, NULL)) AS sellVolumeAVAX,COUNT(DISTINCT (tx_hash)) AS numberOfTrades,SUM(shareAmount) AS numberOfSharesTraded,COUNT(DISTINCT (subject)) AS numberOfSubjects,SUM(COALESCE(COUNT(DISTINCT (firstUserOccurrences.trader)), 0)) OVER (ORDER BYblock_date) AS cumulative_numberOfNewTradersFROMtradesLEFT OUTER JOIN firstUserOccurrences ON (trades.trader = firstUserOccurrences.traderAND trades.block_date = firstUserOccurrences.firstTradeDate)GROUP BYblock_date)SELECT*,SUM(volumeUSD) OVER (ORDER BYblock_date) AS cumulative_volumeUSD,SUM(volumeAVAX) OVER (ORDER BYblock_date) AS cumulative_volumeAVAX,SUM(feesUSD) OVER (