Query editor
-- Daily venue mix on one Robinhood Chain pair — one bar per day, stacked by venue.---- Same four sources as the per-venue snapshot query, bucketed by day:-- 1. dex.trades — every AMM Dune decodes (v3, DLMM, CL, v2)-- 2. uniswap_v4 evt_swap — v4 split by POOL (dex.trades books them all-- against the single PoolManager address)-- 3. robinhood.logs — Fermi's propAMM, undecoded, read raw-- 4. arcus_robinhood — Arcus RFQ, which settles off-pool entirely---- Volume is in QUOTE-TOKEN units so all four legs are computed the same way and-- none depends on a price feed.---- Cost: every leg prunes on its partition column with a constant-foldable-- expression, and dex.trades is read ONCE into `pair_trades` rather than once-- per protocol — reading it twice is what timed this out on the small engine at-- a 14-day window. The Fermi leg reads robinhood.logs (160 GB) and is the part-- that scales with `days`.WITH params AS (SELECTfrom_hex('{{base_token}}') AS base_token,from_hex('{{quote_token}}') AS quote_token),-- Every decoded AMM trade on this pair, read once.pair_trades AS (SELECTt.block_date,t.project,t.version,t.project_contract_address,t.tx_hash,t.evt_index,CASE WHEN t.token_sold_address = p.quote_tokenTHEN t.token_sold_amount ELSE t.token_bought_amount END AS quote_amountFROM dex.trades tCROSS JOIN params pWHERE t.blockchain = 'robinhood'AND t.block_month >= date_trunc('month', current_date - interval '{{days}}' day)AND t.block_date >= current_date - interval '{{days}}' dayAND ( (t.token_bought_address = p.base_token AND t.token_sold_address = p.quote_token)OR (t.token_bought_address = p.quote_token AND t.token_sold_address = p.base_token))),decoded AS (SELECTblock_date AS day,project || ' v' || version AS venue_type,project_contract_address AS venue,count(*) AS trades,sum(quote_amount) AS quote_volumeFROM pair_tradesWHERE NOT (project = 'uniswap' AND version = '4')GROUP BY 1, 2, 3),v4 AS (SELECTt.block_date AS day,'uniswap v4' AS venue_type,