Query editor
with prices_usd as (selectminute, blockchain, symbol, pricefrom prices.usdwhereblockchain is null -- for native tokenand symbol in ('ETH','SOL','AVAX','MATIC')and date_trunc('day',minute) between current_date - interval '{{back_days}}' day and current_date - interval '1' day), ethereum_daily_fee as (selectblock_date, 'ethereum' as blockchain, avg(fee_native) as avg_txnfee_native, approx_percentile(fee_native, 0.5) as median_txnfee_native, avg(fee_usd) as avg_txnfee_usd, approx_percentile(fee_usd, 0.5) as median_txnfee_usdfrom (selectblock_date, txn.gas_price / 1e18 * txn.gas_used as fee_native, txn.gas_price / 1e18 * txn.gas_used * p.price as fee_usdfrom ethereum.transactions txninner join prices_usd pon p.minute = date_trunc('minute',txn.block_time)where txn.block_date between current_date - interval '{{back_days}}' day and current_date - interval '1' dayand p.symbol = 'ETH')group by 1), arbitrum_daily_fee as (selectblock_date, 'arbitrum' as blockchain, avg(fee_native) as avg_txnfee_native, approx_percentile(fee_native, 0.5) as median_txnfee_native, avg(fee_usd) as avg_txnfee_usd, approx_percentile(fee_usd, 0.5) as median_txnfee_usdfrom (selectblock_date, txn.effective_gas_price / 1e18 * txn.gas_used as fee_native, txn.effective_gas_price / 1e18 * txn.gas_used * p.price as fee_usdfrom arbitrum.transactions txninner join prices_usd pon p.minute = date_trunc('minute',txn.block_time)where txn.block_date between current_date - interval '{{back_days}}' day and current_date - interval '1' dayand p.symbol = 'ETH')group by 1)