Query editor
/* Migration success :)There are some cases such as unnest/sequence and array/json functions the migrator won't take care of for you(but we have examples of in the docs linked below!)If you're still running into issues, check out the doc examples https://dune.com/docs/reference/dune-v2/query-engine/or reach out to us in the Dune discord in the #dune-sql channel.*/WITHavg_daily AS (SELECTDATE_TRUNC('day', minute) AS dt,symbol,AVG(price) AS priceFROMprices.usdWHEREsymbol in ('LDO', 'WETH')GROUP BY1,2ORDER BY1 DESC),pivoted AS (SELECTdt,SUM(CASE WHEN symbol = 'LDO' THEN price ELSE 0 END) AS ldo_price,SUM(CASE WHEN symbol = 'WETH' THEN price ELSE 0 END) AS eth_priceFROM avg_dailyGROUP BY 1),running_avg AS (SELECTdt,ldo_price,eth_price,AVG(ldo_price) OVER (ORDER BYdt rows BETWEEN 60 precedingAND current row) AS ldo_avg,AVG(eth_price) OVER (ORDER BYdt rows BETWEEN 60 precedingAND current row) AS eth_avgFROMpivotedORDER BY1 DESC)SELECTdt,ldo_price,ldo_price/eth_price AS ldo_eth,0.001 AS ldo_1000,eth_price,ldo_avg,