balancer / dune-spellbook

SQL views for Dune Analytics
Other
7 stars 11 forks source link

Fix protocol_liquidity_eth and pool_liquidity_eth columns #132

Closed viniabussafi closed 2 months ago

viniabussafi commented 2 months ago

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 ),