From:
eth_prices AS (
SELECT
DATE_TRUNC('day', minute) as day,
AVG(price) as eth_price
FROM {{ source('prices', 'usd') }}
WHERE symbol = 'ETH'
GROUP BY 1
),
To:
eth_prices AS(
SELECT
date_trunc('day', minute) AS day,
APPROX_PERCENTILE(price, 0.5) AS eth_price
FROM prices.usd
WHERE blockchain = 'ethereum'
AND contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
GROUP BY 1
),
From: eth_prices AS ( SELECT DATE_TRUNC('day', minute) as day, AVG(price) as eth_price FROM {{ source('prices', 'usd') }} WHERE symbol = 'ETH' GROUP BY 1 ),
To: eth_prices AS( SELECT date_trunc('day', minute) AS day, APPROX_PERCENTILE(price, 0.5) AS eth_price FROM prices.usd WHERE blockchain = 'ethereum' AND contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 GROUP BY 1 ),