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'when t.symbol is null andfrom_hex(json_query(ac.newConfig, 'strict $.tokenAddress' omit quotes)) = from_hex('0x70d95587d40A2caf56bd97485aB3Eec10Bee6336')then 'GM-ETH'when t.symbol is null andfrom_hex(json_query(ac.newConfig, 'strict $.tokenAddress' omit quotes)) = from_hex('0x47c031236e19d024b42f8ae6780e44a573170703')then 'GM-BTC'else t.symbol end as symbol,casewhen from_hex(json_query(ac.newConfig, 'strict $.tokenAddress' omit quotes)) = from_hex('0x5402b5f40310bded796c7d0f3ff6683f5c0cffdf')then 'GlpManager'when from_hex(json_query(ac.newConfig, 'strict $.tokenAddress' omit quotes)) = from_hex('0x5402b5f40310bded796c7d0f3ff6683f5c0cffdf')then 'GlpManager'when 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)union all