Query editor
WITH Friend AS ( SELECT DATE_TRUNC('day',evt_block_time) AS DATE,CAST(SUM(protocolEthAmount) AS DOUBLE)/1e18 AS protocolEthAmountFROM friendtech_base.FriendtechSharesV1_evt_TradeGROUP BY 1 ),Prices AS (SELECT DATE_TRUNC('day',minute) AS DATE, AVG(price) as PriceFROM prices.usdWHERE symbol='ETH'GROUP BY 1)SELECT a.DATE , protocolEthAmount , protocolEthAmount * Price AS Protocol_USD, SUM(protocolEthAmount) OVER(ORDER BY a.DATE) AS Cumulative_protocolEthAmount, SUM(protocolEthAmount * Price) OVER(ORDER BY a.DATE) AS Cumulative_Protocol_USDFROM Friend aLEFT JOIN Prices b ON a.DATE = b.DATEORDER BY 1 DESC