Query editor
/* Success! If you're still running into issues, check out https://dune.com/docs/query/syntax-differences/ or reach out in the #dune-sql Discord channel. */WITH ohmPrice as (SELECTDATE_TRUNC('hour', minute) as minute--,approx_percentile("price",0.5) AS ohmPrice,min("price") AS ohmPriceFROMprices.usdWHERE"symbol" = 'OHM'and minute >= CAST('{{1 - Start date}}' AS TIMESTAMP)AND minute <= CAST('{{2 - end date}}' AS TIMESTAMP)Group by 1ORDER BY"minute" DESC NULLS FIRST),olympus_index as(SELECTDATE_TRUNC('hour', evt_block_time) AS hour,approx_percentile((index / 1e9),0.5) AS ohmIndex-- AVG(index / 1e9) AS ohmIndexFROMolympus_ethereum.sOlympus_evt_LogRebaseGROUP BY1ORDER BYhour DESC NULLS FIRST),adjOhmPrice AS (SELECT DISTINCTA.minute,A.ohmPrice,A.ohmPrice *B.ohmIndex AS adjusted_price,B.ohmIndexFROMohmPrice AJOIN olympus_index B ON A."minute" = B."hour"ORDER BY1 DESC NULLS FIRST)--select distinct * from adjOhmPrice,eth_price AS (SELECTDATE_TRUNC('hour', minute) as minute,approx_percentile("price",0.5) AS eth_price--,avg(price) AS eth_priceFROMprices.usdWHERE"symbol" = 'ETH'and minute >= CAST('{{1 - Start date}}' AS TIMESTAMP)AND minute <= CAST('{{2 - end date}}' AS TIMESTAMP)Group by 1ORDER BY