Query editor
-- [CA] P0-8a — Gas ETH, DAILY, 2024-01-01…now -> H18-- Reuses the M5 aggregation (verified 2026-09-15: ethereum.transactions.gas_price-- in wei, block_time) but at daily grain over the FULL train+holdout window,-- because H18 needs N>=24 "apathy" episodes and 7d/30d windows cannot supply them.---- H18 trigger: gas at its 90d minimum AND DEX volume < 70% of the 30d median.-- This query supplies the gas leg; the volume leg is P0-8b.---- Kept to Ethereum on purpose: H18 names "газ ETH", and Base/other chains have-- their own fee markets that would blur the signal.-- ⚠️ BIGINT OVERFLOW (first run failed, execution 01M2JWFTDRDNX21S8E1CN10AWA):-- `SUM(gas_used)` over a full day blew past 2^63-- ("bigint addition overflow: 9190629892338756463 + 67966466147143592").-- gas_used and gas_price are BIGINT, and a single day of Ethereum is-- ~1.2M txs x ~150k gas ≈ 2e11 — fine — but the running sum in the-- aggregation is not. Always CAST to DOUBLE before summing wide integer-- columns over long windows.SELECT date_trunc('day', block_time) AS day,AVG(gas_price) / 1e9 AS avg_gwei,approx_percentile(gas_price, 0.50) / 1e9 AS median_gwei,approx_percentile(gas_price, 0.95) / 1e9 AS p95_gwei,COUNT(*) AS txs,SUM(CAST(gas_used AS DOUBLE)) AS gas_used,SUM(CAST(gas_used AS DOUBLE) * CAST(gas_price AS DOUBLE)) / 1e18 AS fees_eth,CASE WHEN date_trunc('day', block_time) < DATE '2026-01-01'THEN 'train' ELSE 'holdout' END AS splitFROM ethereum.transactionsWHERE block_time >= TIMESTAMP '2024-01-01 00:00:00'GROUP BY 1ORDER BY 1 DESC