Query editor
with all_reward_claims AS (select block_time, user, position_address, reward_amount_raw, reward_token, tx_hash from query_3760306UNIONselect block_time, user, position_address, reward_amount_raw, reward_token, tx_hash from query_3759716),-- make it hourly pricesarbitrum_token_prices as (selectdate_trunc('hour', minute) as hour,contract_address,any_value(decimals) as decimals,any_value(symbol) as symbol,avg(price) as pricefrom prices.usd where blockchain = 'arbitrum' group by date_trunc('hour', minute), contract_address),all_reward_claims_usd as (selectblock_time as "timestamp",user as user_address,reward_token,reward_amount_raw / power(10, decimals) as reward_amount,reward_amount_raw / power(10, decimals) * price as reward_amount_usd,tx_hash,symbolfrom all_reward_claims as p left join arbitrum_token_prices as q on (p.reward_token = q.contract_address and date_trunc('hour', p.block_time) = q.hour)),spec_table as (select"timestamp",user_address,casewhen reward_token = 0x912ce59144191c1204e64559fe8253a0e49e6548 then reward_amount -- ARBelse 0end as claimed_arb_amount,casewhen reward_token = 0x912ce59144191c1204e64559fe8253a0e49e6548 then reward_amount_usd -- ARBelse 0end as claimed_arb_usd,casewhen reward_token != 0x912ce59144191c1204e64559fe8253a0e49e6548 then reward_amount_usd -- ARBelse 0end as other_incentive_usdfrom all_reward_claims_usd)select * from spec_tablewhere claimed_arb_usd != 0 or other_incentive_usd != 0and "timestamp" > cast('{{timestamp}}' as TIMESTAMP)order by claimed_arb_usd desc, other_incentive_usd desc