Query editor
-- Ethereum mainnet base fee, last 30 days, 4-hour buckets, 7-day moving average (gwei)-- Extra lookback so the moving average is full-width from the first bucket shownWITH buckets AS (SELECTdate_add('hour', (hour(time) / 4) * 4, date_trunc('day', time)) AS bucket,min(base_fee_per_gas) / 1e9 AS min_gwei,approx_percentile(base_fee_per_gas, 0.10) / 1e9 AS p10_gwei,approx_percentile(base_fee_per_gas, 0.25) / 1e9 AS p25_gwei,approx_percentile(base_fee_per_gas, 0.50) / 1e9 AS p50_gwei,approx_percentile(base_fee_per_gas, 0.75) / 1e9 AS p75_gwei,approx_percentile(base_fee_per_gas, 0.90) / 1e9 AS p90_gwei,max(base_fee_per_gas) / 1e9 AS max_gwei,count(*) AS blocksFROM ethereum.blocksWHERE date >= current_date - INTERVAL '38' DAYAND time >= now() - INTERVAL '37' DAYGROUP BY 1), smoothed AS (SELECT *, avg(p50_gwei) OVER (ORDER BY bucket ROWS BETWEEN 41 PRECEDING AND CURRENT ROW) AS ma_gweiFROM buckets)SELECT * FROM smoothedWHERE bucket >= now() - INTERVAL '30' DAYORDER BY bucket