Query editor
-- Full-history accrued Tycho router revenue and separate client fees.-- Revenue is call-spined so zero-fee periods remain explicit. USD values are-- priced subtotals; exact token atomics remain authoritative in the companion.WITH source_physical AS (SELECTCAST(data_chain AS VARCHAR) AS data_chain,period_start,metric_name,metric_value,observed_row_count,priced_row_count,coverage_status,release_statusFROM "query_7970737(chain='{{chain}}',timeframe='{{timeframe}}',end_date_mode='through_current_day',start_date='2025-01-01 00:00:00',end_date='2100-01-01 00:00:00')"WHERE metric_family = 'tycho_fee'AND metric_name IN ('propellerheads_accrued_revenue_priced_usd_subtotal','tycho_router_fee_revenue_priced_usd_subtotal','tycho_positive_slippage_revenue_priced_usd_subtotal','client_integrator_fee_priced_usd_subtotal')),-- selected_only preserves the historical one-scope result for every chain-- parameter, including chain=all. collector_fanout is active only with-- chain=all and adds each physical scope beside the independently grouped all-- scope, so q7970737 is still invoked only once.source AS (SELECTscope.output_chain,physical.period_start,physical.metric_name,physical.metric_value,physical.observed_row_count,physical.priced_row_count,physical.coverage_status,physical.release_statusFROM source_physical physicalCROSS JOIN UNNEST(CASEWHEN '{{chain}}' = 'all'AND '{{scope_mode}}' = 'collector_fanout'THEN ARRAY[physical.data_chain, 'all']WHEN '{{chain}}' = 'all' THEN ARRAY['all']ELSE ARRAY[physical.data_chain]END) AS scope(output_chain)),release_gate AS (SELECT COUNT_IF(COALESCE(release_status, 'fail') <> 'pass') AS failing_rowsFROM source),periods AS (SELECT DISTINCToutput_chain,period_startFROM source