Query editor
with tx_counterparties_with_volume as (selectb.tx_hash,dt.project as counterparty_protocol,sum(dt.amount_usd) as total_volume_usdfrom cow_protocol_ethereum.batches as binner join dex.trades as dt on b.tx_hash = dt.tx_hashwhere dt.blockchain = 'ethereum'group by b.tx_hash, dt.project),final_data as (selectb.tx_hash,concat(s.environment, '-', s.name) as solver_namefrom cow_protocol_ethereum.batches as binner join cow_protocol_ethereum.solvers as s on s.address = b.solver_addresswhere (concat(s.environment, '-', s.name) = 'prod-Tsolver' or address = 0x3980dAA7EaaD0B7e0C53cFc5c2760037270DA54D)and b.block_date > now() - interval '30' day),aggregated_counterparties as (selecttcwv.counterparty_protocol,sum(tcwv.total_volume_usd) as total_volume_usdfrom tx_counterparties_with_volume as tcwvinner join final_data as fd on tcwv.tx_hash = fd.tx_hashgroup by tcwv.counterparty_protocol),ranked_counterparties as (selectcounterparty_protocol,total_volume_usd,row_number() over (order by total_volume_usd desc) as counterparty_rankfrom aggregated_counterparties)selectcounterparty_protocol,round(total_volume_usd, 2) as total_volume_usdfrom ranked_counterparties-- where counterparty_rank <= 10order by total_volume_usd desc;