Query editor
-- Tycho dashboard/Metrix shadow adapter over frozen physical facts.---- Parameters (end_date is exclusive):-- {{chain}}: all | ethereum | base | unichain | arbitrum | bnb | polygon |-- plasma | robinhood-- {{timeframe}}: all | daily | weekly | monthly-- {{end_date_mode}}: through_current_day | completed_days | custom-- {{start_date}}, {{end_date}}: YYYY-MM-DD---- Router input, executor-leg volume, and fee revenue are deliberately separate-- metric families. Executor legs are not additive to router input. Exact token-- units are retained as strings so UINT256 values are never rounded through a-- DOUBLE. This query references physical facts only: no query view or raw-- chain table may be added.WITH requested_params AS (SELECTCAST(LOWER('{{chain}}') AS VARCHAR(12)) AS requested_chain,CAST(LOWER('{{timeframe}}') AS VARCHAR(8)) AS timeframe,CAST(LOWER('{{end_date_mode}}') AS VARCHAR(20)) AS end_date_mode,CAST(CAST('{{start_date}}' AS TIMESTAMP) AS DATE) AS window_start,CAST(CAST('{{end_date}}' AS TIMESTAMP) AS DATE) AS requested_window_end,CAST(at_timezone(CURRENT_TIMESTAMP, 'UTC') AS DATE) AS utc_today,LOWER('{{chain}}') IN ('all', 'ethereum', 'base', 'unichain', 'arbitrum', 'bnb', 'polygon','plasma', 'robinhood') AS has_supported_chain,LOWER('{{timeframe}}') IN ('all', 'daily', 'weekly', 'monthly')AS has_supported_timeframe),resolved_params AS (SELECTrequested_chain,timeframe,end_date_mode,window_start,CASEWHEN end_date_mode = 'through_current_day'THEN date_add('day', 1, utc_today)WHEN end_date_mode = 'completed_days' THEN utc_todayWHEN end_date_mode = 'custom' THEN requested_window_endEND AS window_end,has_supported_chain,has_supported_timeframeFROM requested_params),params AS (SELECTrequested_chain,timeframe,end_date_mode,window_start,window_end,has_supported_chain,has_supported_timeframe,end_date_mode IN ('through_current_day', 'completed_days', 'custom')AS has_supported_end_date_mode,end_date_mode IN ('through_current_day', 'completed_days', 'custom')