Query editor
with pool as (selectpool as address, blockchainfrom (selectpool,'arbitrum' as blockchainfrom gyroscope_arbitrum.GyroECLPPoolFactory_evt_PoolCreatedunion allselectpool,'arbitrum' as blockchainfrom gyroscope_arbitrum.Gyro2CLPPoolFactory_evt_PoolCreated)),liquidity as (selectb.day,p.address,ROW_NUMBER() OVER (PARTITION BY address, day ORDER BY token_address) - 1 AS token_index,token_address,token_symbol,token_balance as token_amount,pool_liquidity_usd as token_amount_usdfrom balancer.liquidity bjoin pool pon p.address = b.pool_addressand b.blockchain = p.blockchaingroup by 1,2,4,5,6,7),volume as (selectdate(block_time) as day,project_contract_address,sum(amount_usd) as volumefrom dex.trades djoin pool pon p.address = d.project_contract_address and d.blockchain = p.blockchaingroup by 1,2),gyd_pool_result as (selectl.day as timestamp,address as pool_address,token_index,token_address,token_symbol,token_amount,token_amount_usd,coalesce(v.volume,0) as pool_volume_usd,coalesce(v.volume,0) * q.fee_rate as pool_fees_usd,-- will adjust below when pool incentive starts --'0' as pool_incentive_amount,'0' as pool_incentive_usdfrom liquidity lleft join volume v on v.project_contract_address = l.address and v.day = l.day