Query editor
-- This query used incompatible data types from Dune SQL alpha and may need to be updated.-- More details can be found on https://dune.com/docs/query/dunesql-changes/with date_filter as (select (casewhen '{{date_period}}' = '30 Days' then now() - interval '30' daywhen '{{date_period}}' = '3 Months' then now() - interval '3' monthwhen '{{date_period}}' = '6 Months' then now() - interval '6' monthwhen '{{date_period}}' = '1 Year' then now() - interval '1' yearelse date('2021-01-01')end) as start_date)select date_trunc('day', block_time) as block_date,avg(cast(effective_gas_price as double) * gas_used) / 1e9 as avg_gas_fee,avg(effective_gas_price) / 1e9 as avg_effective_gas_price,avg(gas_used) as avg_gas_usedfrom arbitrum.transactionsinner join date_filter on truewhere success = trueand block_time >= date_filter.start_dateand gas_used > 0 -- Exclude system transaction with 0 gas_usedgroup by 1