Query editor
-- Two-way rule read-back from CoW's ORDER dataset (the quote table for 11-30 is not posted): per period and owner-- group, the fills CoW flags quote-eligible by whose quote is stored and who settled. 2026-12-01.with t as (select order_uid, tx_hash, block_time, usd_value, partial_fill,case when lower(to_hex(trader)) in ('98ac5b90e4562baee0ed3989fc587dfe3ca7d9b5', 'e84353dbcf2a71890aa069a432198f84166045e6', 'ebef2aed95a5219ad2da2942ad27df26c68620df', '8d4dbe6dfcd42015e58d8856109f579f27e76a31', 'b777c453b8a3e47df03de4d36408a5014f74f3ba', '57281d1045b459e738393bfdfc17b8e961965474', 'e29771d17e879beae9be4b7127f3d5c7bbd50a36', '1074526386cf34da62ffe4b06b47f0f560d58f17', '1298a8d46931c2920e3dcf358d415f91ab79e3ab', 'd35d7fb17ee3061ee6ef5f6856a3cef70d5a1cf1', 'e3c0c6cad89a83c9424d5c21abcc380ceee3ac0f', 'a4ad63e9b5967474b620adfd8e73e0e978e964a7', '8eb3efea8a3e46c145a13b5873c6e5c129e5d787', '364acb22141089ba72d3e7de4fdde4af1b242b58') then 'two_way' else 'other' end grp,case when block_time < timestamp '2026-11-30 00:00' then 'a 11-29'when block_time < timestamp '2026-11-30 18:14' then 'b 11-30 to 18:14'when block_time < timestamp '2026-11-30 18:40' then 'c cold start'when block_time < timestamp '2026-12-01 00:00' then 'd 11-30 from 18:40'else 'e 12-01' end periodfrom cow_protocol_ethereum.tradeswhere block_time >= timestamp '2026-11-29 00:00' and block_time < timestamp '2026-12-02 00:00'),od as (select order_uid, tx_hash, bool_or(el0) el, max(qs0) qs, max(sv0) sv,sum(case when qbc0 < 1e18 then qbc0 else 0 end) qbcfrom (select order_uid, tx_hash, is_eligible_for_quote_reward el0, lower(to_hex(cast(quote_solver as varbinary))) qs0,lower(to_hex(cast(solver as varbinary))) sv0,try_cast(replace(cast(quote_budget_contribution as varchar), '_', '') as double) qbc0 from dune.cowprotocol.dataset_prod_order_data_mainnet_2026_11union allselect order_uid, tx_hash, is_eligible_for_quote_reward el0, lower(to_hex(cast(quote_solver as varbinary))) qs0,lower(to_hex(cast(solver as varbinary))) sv0,try_cast(replace(cast(quote_budget_contribution as varchar), '_', '') as double) qbc0 from dune.cowprotocol.dataset_prod_order_data_mainnet_2026_12) xgroup by 1, 2)select 'R' k, t.period, t.grp, cast(coalesce(od.el, false) as varchar) el,case when od.qs = 'a7842153fde380a864726d0e91f14f6ffab7d46c' then 'ours' else 'rival' end quote,case when od.sv = 'a7842153fde380a864726d0e91f14f6ffab7d46c' then 'us' else 'other' end settled,count(*) fills, sum(t.usd_value) usd, sum(od.qbc) / 1e18 qbc_eth,cast(min(t.block_time) as varchar) t_first, cast(max(t.block_time) as varchar) t_lastfrom t join od on od.order_uid = t.order_uid and od.tx_hash = t.tx_hashgroup by 2, 3, 4, 5, 6union allselect 'S', t.period, t.grp, '', '', coalesce(od.sv, '-'), count(*), sum(t.usd_value), sum(od.qbc) / 1e18, '', ''from t join od on od.order_uid = t.order_uid and od.tx_hash = t.tx_hashwhere t.grp = 'two_way' group by 2, 3, 6