Query editor
withtime_seq as (selectsequence(CAST('2025-07-13' as timestamp),date_trunc('hour', cast(now() as timestamp)),interval '1' hour) as time),hours as (selecttime.time as hourfrom time_seqcross join unnest(time) as time(time)),hourly_rates as (select*,lead(hour, 1, current_timestamp) over (partition by trove_id, collateral_type order by hour asc) as next_hourfrom (selectdate_trunc('hour', block_time) as hour,trove_id,collateral_type,max_by(collateral, (block_number, tx_index)) as collateral,max_by(debt, (block_number, tx_index)) as debtfromquery_6070722group by 1, 2, 3)),filled_rates as (selecth.hour,c.trove_id,c.collateral_type,c.collateral,c.debtfromhourly_rates cinner joinhours hon c.hour <= h.hourand h.hour < c.next_hour),get_prices as (selectdate_trunc('hour', minute) as hour,symbol,max_by(price, minute) as pricefromprices.usdwhere minute >= date '2025-01-01'and blockchain = 'arbitrum'and symbol in ('WETH', 'wstETH', 'rETH','rsETH','weETH','ARB','COMP','tBTC')