Query editor
with mined as (select evt_block_time as timestamp, evt_tx_hash as glaze_id, price, minerfrom donutcompany_base.miner_evt_miner__minedwhere contract_address = from_hex('0xF69614F4Ee8D4D3879dd53d5A039eB3114C794F6')),minted as (select evt_tx_hash, amount as mined_rawfrom donutcompany_base.miner_evt_miner__minted),miner_fee as (select evt_tx_hash, amount as earned_rawfrom donutcompany_base.miner_evt_miner__minerfee),eth_prices as (select minute, avg(price) as eth_usdfrom prices.usdwhere blockchain = 'base' and symbol = 'WETH'group by minute),glaze as (selectm.timestamp,m.price/1e18 as spent_eth,coalesce(f.earned_raw,0)/1e18 as earned_ethfrom mined mleft join miner_fee f on f.evt_tx_hash = m.glaze_id),glaze_usd as (selectdate_trunc('day', g.timestamp) as day,g.spent_eth * p.eth_usd as spent_usd,g.earned_eth * p.eth_usd as earned_usdfrom glaze gleft join eth_prices pon date_trunc('minute', g.timestamp) = p.minute)selectday,sum(spent_usd) as daily_spent_usd,sum(earned_usd) as daily_earned_usd,sum(earned_usd) - sum(spent_usd) as daily_pnl_usdfrom glaze_usdgroup by dayorder by day;