Query editor
/*Preparing data*/with tokens(contract_address, symbol, price_source, decimals) as (selectfrom_hex(json_query(ac.newConfig, 'strict $.tokenAddress' omit quotes)) as contract_address,casewhen t.symbol is null andfrom_hex(json_query(ac.newConfig, 'strict $.tokenAddress' omit quotes)) = from_hex('0x5402b5f40310bded796c7d0f3ff6683f5c0cffdf')then 'sGLP'else t.symbol end as symbol,casewhen from_hex(json_query(ac.newConfig, 'strict $.tokenAddress' omit quotes)) = from_hex('0x5402b5f40310bded796c7d0f3ff6683f5c0cffdf')then 'GlpManager'else 'arbitrum' end as price_source,coalesce(t.decimals, 18) as decimalsfrom hmx_arbitrum.ConfigStorage_evt_LogSetCollateralTokenConfig as ccinner join hmx_arbitrum.ConfigStorage_evt_LogSetAssetConfig as ac onac.assetId = cc.assetIdleft join prices.tokens as ton from_hex(json_query(ac.newConfig, 'strict $.tokenAddress' omit quotes)) = t.contract_addressand t.blockchain in ('arbitrum')),glp_prices as (selectdate_trunc('day', block_time) as time,'sGLP' as symbol,18 as decimals,from_hex('0x5402b5f40310bded796c7d0f3ff6683f5c0cffdf') as contract_address,avg(price) as avg_pricefrom(selectevt_block_time as block_time,(usdgAmount * 1e18 / mintAmount) / 1e18 as pricefrom gmx_arbitrum.GlpManager_updated_evt_AddLiquidity) as p_glpwhere p_glp.block_time >= timestamp '2023-06-21 00:00'group by 1, 2, 3, 4),token_prices as (selectdate_trunc('day', minute) as time,p.symbol,p.decimals,t.contract_address,avg(price) as avg_pricefrom prices.usd pinner join tokens ton p.contract_address = t.contract_addressand p.blockchain = t.price_sourcewhere p.minute >= timestamp '2023-06-21 00:00'group by 1, 2, 3, 4union all