Query editor
WITH sales AS (SELECT block_date, sum(amount_usd) as amountFROM dex.tradesWHERE token_sold_symbol = 'USDC'AND blockchain = 'ethereum'AND block_date >= date('2023-01-01') AND block_date <= date('2023-03-28')GROUP BY 1),buys AS (SELECT block_date, sum(amount_usd) as amountFROM dex.tradesWHERE token_bought_symbol = 'USDC'AND blockchain = 'ethereum'AND block_date >= date('2023-01-01') AND block_date <= date('2023-03-28')GROUP BY 1)SELECT s.block_date, b.amount as buy_volume, s.amount as sell_volume, b.amount-s.amount as net_flow, (b.amount-s.amount)/(b.amount+s.amount) as net_flow_percentFROM sales s LEFT JOIN buys b ON s.block_date = b.block_date