Query editor
with rewards as (selectdate_trunc('hour', block_time) as time_rewarded, reward_type, round(amount / pow(10,9), 4) as amount_rewarded-- , to_owner, to_token_accountfrom hivemapper_solana.rewards aorder by block_date desc),hourly_prices as (with honey_prices as (selectdate_trunc('hour', block_time) as hour, amount_usd / token_bought_amount as honey_pricefrom dex_solana.tradeswhere token_bought_symbol = 'HONEY')selecthour, avg(honey_price) as usd_pricefrom (selecthour, honey_price, row_number() over (partition by hour order by honey_price asc) as prices_asc, row_number() over (partition by hour order by honey_price desc) as prices_descfrom honey_prices) dfwhere prices_asc in (prices_desc, prices_desc - 1, prices_desc + 1)group by hourorder by hour desc)select-- time_rewarded-- , reward_type-- , amount_rewarded-- , round(usd_price, 4) as usd_pricesum(round(amount_rewarded * usd_price, 2)) as total_usd_rewardedfrom rewards rjoin hourly_prices p on r.time_rewarded = p.hourwhere to_token_account = '{{wallet_address}}'and reward_type in (select reward_type from unnest(split('{{reward_type}}', ',')) as c(reward_type))-- (Select token from unnest(split('{{token_list_parameter}}',',')and (time_rewarded >= cast('{{start_date}}' as timestamp) and time_rewarded <= cast('{{end_date}}' as timestamp))-- order by time_rewarded desc