Query editor
withpepebuy as (selectdate_trunc('hour',block_time) as hour1,sum(token_bought_amount_raw) as sum_b_row,sum(amount_usd) as sum_usd_bfromdex.tradeswheretoken_bought_address = 0x6982508145454ce325ddbe47a25d4ec3d2311933 -- pepeand tx_from = 0x241047580ad17f5af698ff65c29b41d3332115ef -- whalegroup by 1),pepesell as (selectdate_trunc('hour',block_time) as hour2,sum(token_sold_amount_raw) as sum_s_row,sum(amount_usd) as sum_usd_sfromdex.tradeswheretoken_sold_address = 0x6982508145454ce325ddbe47a25d4ec3d2311933 -- pepeand tx_from = 0x241047580ad17f5af698ff65c29b41d3332115ef -- whalegroup by 1),price as (select hour ,median_price from dex.priceswhere contract_address = 0x6982508145454ce325ddbe47a25d4ec3d2311933--PEPEorder by hour desc)selecthour,median_price,(sum_b_row/1e9) as sum_b_row,sum_usd_b,(sum_b_row * median_price)/1e18 as sum_usd_bought,-(sum_s_row/1e9) as sum_s_row,-(sum_usd_s) as sum_usd_s,-(sum_s_row * median_price)/1e18 as sum_usd_soldfrompriceleft join pepebuy on hour1 = hourleft join pepesell on hour2 = hourorder by 1 desc