Query editor
WITHconstants as (selectcast({{decimal_token0}} as int) as decimalToken0,cast({{decimal_token1}} as int) as decimalToken1,{{pool_address}} as addressPool) --,ts as (select1 as tickSpacingfromuniswap_v3_arbitrum.UniswapV3Factory_evt_PoolCreated,constantswherepool = addressPoollimit1),ct as (selecttick as currentTick,cast(sqrtPriceX96 / power(2, 96) as double) as sqrtPricefromuniswap_v3_arbitrum.Pair_evt_Swap,constantswherecontract_address = addressPooland evt_block_time <= casewhen cast({{use_specfic_date}} as INTEGER) = 1 then cast('{{as_of_specific_date}}' as TIMESTAMP)else now()endorder byevt_block_time desclimit1) --,mb as (selecttickLower as lowerTick --,tickUpper as upperTick --,cast(amount as double) / sqrt(power(10, decimalToken0 + decimalToken1)) as amountfromuniswap_v3_arbitrum.Pair_evt_Mint,constantswherecontract_address = addressPooland evt_block_time <= casewhen cast({{use_specfic_date}} as INTEGER) = 1 then cast('{{as_of_specific_date}}' as TIMESTAMP)else now()endunion allselecttickLower as lowerTick --,tickUpper as upperTick --,