Query editor
WITH Friend AS ( SELECT DATE_TRUNC('day',evt_block_time) AS DATE,CAST(SUM(ethAmount) AS DOUBLE)/1e18 AS ethAmountFROM friendtech_base.FriendtechSharesV1_evt_TradeGROUP BY 1 ),Prices AS (SELECT DATE_TRUNC('day',minute) AS DATE, AVG(price) as PriceFROM prices.usdWHERE symbol='ETH'AND blockchain IS NULLGROUP BY 1)SELECT a.DATE , ethAmount , ethAmount * Price AS Inflow_USD, SUM(ethAmount) OVER(ORDER BY a.DATE) AS Cumulative_Inflow_ETH, SUM(ethAmount * Price) OVER(ORDER BY a.DATE) AS Cumulative_Inflow_USDFROM Friend aLEFT JOIN Prices b ON a.DATE = b.DATEORDER BY 1 DESC