Query editor
with xen_price_in_usdc as (select date_trunc('hour', evt_block_time) as block_date,'XEN' as symbol,'0x06450dee7fd2fb8e39061434babcfc05599a6fb8' as contract_address, -- XEN18 as decimals,avg(amount1 / amount0) / pow(10, (6-18)) as pricefrom (select contract_address,-- abs(amount0) as amount0,abs(CAST(amount0 AS DOUBLE)) as amount0,abs(CAST(amount1 AS DOUBLE)) as amount1,evt_tx_hash,evt_block_timefrom uniswap_v3_ethereum.Pair_evt_Swapwhere contract_address = 0x353bb62ed786cdf7624bd4049859182f3c1e9e5d -- XEN-USDC 1.00% Pairand evt_block_time > CAST('2022-10-07' AS TIMESTAMP)and evt_block_time > now() - interval '30' day) sgroup by 1, 2, 3, 4),usdc_price as (select date_trunc('hour', minute) as block_date,avg(price) as pricefrom prices.usdwhere contract_address = 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 -- USDCand minute > CAST('2022-10-07' AS TIMESTAMP)and minute > now() - interval '30' daygroup by 1)select x.block_date,x.price * u.price as price_usdfrom xen_price_in_usdc xinner join usdc_price u on x.block_date = u.block_dateorder by x.block_date