Query editor
with pool_list as (select blockchain,poolfrom uniswap.poolswhere token0 in (0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8, 0x0000206329b97DB379d5E1Bf586BbDB969C63274, 0xe0b52e49357fd4daf2c15e02058dce6bc0057db4, 0x9485aca5bbBE1667AD97c7fE7C4531a624C8b1ED, 0xFA5Ed56A203466CbBC2430a43c66b9D8723528E7)or token1 in (0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8, 0x0000206329b97DB379d5E1Bf586BbDB969C63274, 0xe0b52e49357fd4daf2c15e02058dce6bc0057db4, 0x9485aca5bbBE1667AD97c7fE7C4531a624C8b1ED, 0xFA5Ed56A203466CbBC2430a43c66b9D8723528E7)),trade_detail as (select u.* from uniswap.trades uinner join pool_list p on u.project_contract_address = p.pooland u.blockchain = p.blockchain),trade_summary as (select blockchain,(case when token_bought_address = 0x0000206329b97DB379d5E1Bf586BbDB969C63274 or token_sold_address = 0x0000206329b97DB379d5E1Bf586BbDB969C63274then 'USDA'else 'EURA'end) as token_type,sum(amount_usd) as amountfrom trade_detailgroup by 1, 2)select blockchain,token_type,amount,sum(amount) over (partition by token_type) as total_amountfrom trade_summaryorder by token_type