Query editor
with transactions as(selectsw.chain, sw.evt_tx_hash as tx_hash, sw.evt_tx_from as tx_from, sw.evt_tx_to as tx_to, sw.evt_tx_index as tx_index, sw.evt_index, sw.evt_block_time as block_time, sw.evt_block_number as block_number, sw.evt_block_date as block_date, sw.assetIn, sw.amountIn, sw.amountIn * pr_i.price / pow(10,pr_i.decimals) as amount_in_usd, pr_i.symbol as symbolIn, sw.assetOut, sw.amountOut, sw.amountOut * pr_o.price / pow(10,pr_o.decimals) as amount_out_usd, pr_o.symbol as symbolOut, sw.receiver, sw.senderfrom spark_protocol_multichain.psm3_evt_swap swleft join prices.hour pr_i on (sw.assetIn=pr_i.contract_address and sw.chain=pr_i.blockchain and sw.evt_block_date=pr_i.timestamp)left join prices.hour pr_o on (sw.assetOut=pr_o.contract_address and sw.chain=pr_o.blockchain and sw.evt_block_date=pr_o.timestamp))select chain, block_date, concat(greatest(symbolIn,symbolOut),'-',least(symbolIn,symbolOut)) as pair, sum(amount_in_usd) as volumefrom transactionsgroup by 1,2,3