Query editor
WITH exchanges AS (SELECTDATE_TRUNC('DAY', block_time) as time--, token_bought_amount AS eth_amount, token_sold_amount AS steth_amount, amount_usd, projectFROM dex.tradesWHERE token_bought_symbol not IN ('stETH', 'wstETH')AND token_sold_symbol IN ('stETH', 'wstETH')UNION ALLSELECTDATE_TRUNC('DAY', block_time) as time--, token_sold_amount AS eth_amount, token_bought_amount AS steth_amount, amount_usd, projectFROM dex.tradesWHERE token_sold_symbol NOT IN ('stETH', 'wstETH')AND token_bought_symbol IN ('stETH', 'wstETH'))SELECTtime, SUM(cast(steth_amount as double)) AS steth_amount, SUM(cast(amount_usd as double)) AS usd_amount, projectFROM exchangeswhere time >= now() - interval '6' monthGROUP BY time,projectORDER BY time/*WITH exchanges AS(SELECTDATE_TRUNC('day', "block_time") as time,token_a_amount AS eth_amount,token_b_amount AS steth_amount,usd_amount,"project"FROM dex."trades"WHERE token_a_symbol IN ('ETH', 'WETH') AND token_b_symbol IN ('stETH', 'wstETH')UNION ALLSELECTDATE_TRUNC('day', "block_time") as time,(token_b_amount) AS eth_amount,token_a_amount AS steth_amount,usd_amount,"project"