Query editor
with buys as (selectdate_trunc('day', block_time) as day,sum(amount_usd) as buy_volume_usd,count(*) as buy_tradesfrom dex.tradeswhere blockchain = 'base'and token_bought_address = {{contract_address}}and amount_usd > 0and token_bought_amount > 0group by 1),sells as (selectdate_trunc('day', block_time) as day,sum(amount_usd) as sell_volume_usd,count(*) as sell_tradesfrom dex.tradeswhere blockchain = 'base'and token_sold_address = {{contract_address}}and amount_usd > 0and token_sold_amount > 0group by 1)selectcoalesce(b.day, s.day) as day,coalesce(b.buy_volume_usd, 0) as buy_volume_usd,coalesce(s.sell_volume_usd, 0) as sell_volume_usd,coalesce(b.buy_trades, 0) as buy_trades,coalesce(s.sell_trades, 0) as sell_trades,coalesce(b.buy_volume_usd, 0)+ coalesce(s.sell_volume_usd, 0) as total_daily_volume,coalesce(b.buy_trades, 0) + coalesce(s.sell_trades, 0) as daily_tradesfrom buys bfull outer join sells s on b.day = s.dayorder by day asc