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-Rizzolver' or address = 0x8f5835e9d756c9bd934bce527157a4b0ef3c5cb7 or address = 0x4cf2ca9d42ea35767ca209494371689e9fbb2cc4)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;