Query editor
-- Decrypt Information Exchange — weekly fees earned vs. gas sponsorship spend (USD)-- Fees are counted when earned (perps builder fees per order, not when withdrawn).-- Sponsorship spend is shown as a negative number so the two sides read as revenue vs. cost.WITH lines AS (SELECT day,CASE productWHEN 'Swaps' THEN 'Fees: swaps (' || action || ')'WHEN 'Private Balance' THEN 'Fees: Private Balance setup'WHEN 'Perps' THEN 'Fees: perps builder'ELSE 'Fees: withdrawal charges'END AS line_item,fee_usd AS usdFROM query_9176158WHERE fee_usd IS NOT NULLUNION ALLSELECT day, 'Gas sponsorship: ' || product, -usd_amountFROM dune.ilanhz.result_decrypt_ix_flowsWHERE flow = 'Sponsor spend')SELECT date_trunc('week', day) AS week, line_item, sum(usd) AS usdFROM linesGROUP BY 1, 2ORDER BY 1, 2