Query editor
WITH configs AS (SELECTTRY_CAST({{token0Decimal}} AS INTEGER) AS token0Decimal,TRY_CAST({{token1Decimal}} AS INTEGER) AS token1Decimal,{{token0Address}} AS token0,{{token1Address}} AS token1,{{UniswapV3PoolAddress}} AS addressPool,{{NonfungiblePositionManagerAddress}} AS nfpmAddress), positions AS (SELECTmint.evt_block_time AS blockTime,TRY_CAST(mint.amount0 AS DOUBLE) / POWER(10, c.token0Decimal) AS amount0,TRY_CAST(mint.amount1 AS DOUBLE) / POWER(10, c.token1Decimal) AS amount1FROM uniswap_v3_ethereum.Pair_evt_Mint AS mintJOIN configs AS cON mint.contract_address = c.addressPool AND mint.sender = c.nfpmAddress), token0Price AS (SELECTminute AS minute0,contract_address AS token0Address,symbol AS symbol0,price AS token0PriceFROM prices.usd AS pJOIN configs AS cON p.contract_address = c.token0), token1Price AS (SELECTminute AS minute1,contract_address AS token1Address,symbol AS symbol1,price AS token1PriceFROM prices.usd AS pJOIN configs AS cON p.contract_address = c.token1), prices AS (SELECTt0.minute0,t0.token0Price,t0.symbol0,t1.token1Price,t1.symbol1FROM token0Price AS t0JOIN token1Price AS t1ON t0.minute0 = t1.minute1), poolInfo AS (SELECTpositions.amount0,positions.amount1,p.token0Price,p.token1Price,p.symbol0,p.symbol1,positions.blockTimeFROM positionsJOIN prices AS pON p.minute0 = DATE_TRUNC('minute', positions.blockTime)), lpValueInfo AS (SELECTpoolInfo.amount0 * poolInfo.token0Price AS value0,poolInfo.amount1 * poolInfo.token1Price AS value1,