Query editor
-- Shout out to Andrew Hong and Dataalways for the dashboard and tutorial-- Resources: https://web3datadegens.substack.com/p/web3-sql-weekly-5-how-to-identifywith total as (selectdate_trunc('day', block_time) as day,sum(fee) as total_feesfrom bitcoin.transactionswhere block_height > 767429group by 1),price as (select date_trunc('day',minute) as day, avg(price) as pricefrom prices.usdwhere contract_address is null and symbol = 'BTC'and minute>=cast(date('2022-12-14')as timestamp)group by 1)select a.day,daily_ordinals,sum(daily_ordinals) over (order by a.day asc) as cumulative_ordinals,ordinal_fees*price as ordinal_fees,(total_fees-ordinal_fees)*price as non_ordinal_fees,ordinal_fees/total_fees as ordinal_fees_percentfrom (selectdate_trunc('day', block_time) as day,count(*) as daily_ordinals,sum(fee) as ordinal_feesfrom bitcoin.transactionswhere block_height > 767429and cast(hex as varchar) like '%0063036f726401%'group by 1)aleft join total bon a.day=b.dayleft join price con a.day=c.day