Query editor
-- Atlas market-intel daily series + per-fee-tier volume (powers the-- one-sided LP advisor + the Explore 'Volume by fee tier' breakdown).-- One row per (pair, UTC day, fee_tier, project, source):-- * price median quote-per-base from trade amount ratios-- (USD-independent, correct for non-USD-quote pairs-- like WBTC-WETH)-- * volume_usd USD volume in that bucket that day-- * trade_count trades that day-- Fee tier is resolved by joining dex.trades.project_contract_address to-- the Uniswap v3 factory PoolCreated fee (the dominant tiered venue);-- Uniswap / Sushiswap v2 are the fixed 0.30% tier; everything else-- (Uniswap v4 singleton, Curve, Balancer) stays 'unknown' and the Atlas-- Rust recommender falls back to the realized-volatility bucket (see-- docs/market-intel.md). The per-tier split lets the recommender pick-- the market-driven (fee-revenue maximizing) tier per pair.---- The 'unknown' bucket is emitted at a per-PROJECT grain (carrying the-- on-chain dex.trades.project) so the Explore 'Other' fee-tier row can-- be attributed by venue (Curve / Uniswap V4 / Swaap / Ekubo / ...);-- the resolved-tier rows keep their (pair, day, fee_tier) grain with-- project NULL. The Atlas parser sums the per-project unknown rows back-- into the single 'unknown' per-tier total AND splits them into-- per_protocol_other_volume. A snapshot predating the column degrades-- to the single 'Other' row.---- Intent / aggregator lens (the 'source' column): CoW + 1inch (incl.-- the 1inch-LOP leg Fusion settles through) from dex_aggregator.trades-- (agg_matched), UniswapX from the Dutch-order reactor Fill events-- enriched via tokens.transfers (ux_*), and the RFQ / aggregator--- settlement projects Dune tags as on-chain DEX venues in dex.trades-- (native / 0x API; rfq_matched) - all emitted under a venue `source`-- so they fold into aggregator_volume_usd / per_venue_volume instead of-- double-booking into the pool volume. The pool rows exclude those RFQ-- projects for the same reason. Non-'pool' rows carry a price but the-- Atlas parser excludes them from the band / vol / per-fee-tier.-- Params: blockchain (text), lookback_days (number), pairs (CSV "<A>-<B>").WITH wanted AS (SELECT trim(p) AS pair,upper(split_part(trim(p), '-', 1)) AS base_sym,upper(split_part(trim(p), '-', 2)) AS quote_symFROM unnest(split('{{pairs}}', ',')) AS t(p)),-- Pool -> fee for the dominant tiered venue (Uniswap v3). fee is in-- hundredths of a bip: 100=0.01%, 500=0.05%, 3000=0.30%, 10000=1.00%.v3_pool_fee AS (SELECT pool, fee FROM uniswap_v3_ethereum.factory_evt_poolcreated),matched AS (SELECT w.pair,t.block_date AS day,t.amount_usd,t.project,CASEWHEN v3.fee = 100 THEN '0.01'WHEN v3.fee = 500 THEN '0.05'WHEN v3.fee = 3000 THEN '0.30'WHEN v3.fee = 10000 THEN '1.00'WHEN v3.fee IS NOT NULL THEN 'unknown'WHEN t.project IN ('uniswap', 'sushiswap') AND t.version = '2' THEN '0.30'ELSE 'unknown'