Query editor
--- query_4898824: #sonieum-newsalewith response as (SELECT http_get('https://api.coingecko.com/api/v3/simple/price?ids=astar,ethereum&vs_currencies=usd') AS pricesFROM (SELECT 1 LIMIT 1) -- Ensure only one HTTP request is made),token_prices AS (SELECT'ETH' AS currency,token_pricefrom (select price * 1.0 AS token_pricefrom prices.usd_latest where symbol = 'WETH'and blockchain = 'base')-- SELECT'ETH' AS currency, cast(JSON_EXTRACT_SCALAR(prices, '$.ethereum.usd') as double) AS token_price-- FROM responseUNION ALL-- SELECT'WETH' AS currency, cast(JSON_EXTRACT_SCALAR(prices, '$.ethereum.usd') as double) AS token_price-- FROM responseSELECT'WETH' AS currency,token_pricefrom (select price * 1.0 AS token_pricefrom prices.usd_latest where symbol = 'WETH'and blockchain = 'base')UNION ALLSELECT 'ASTR' AS currency, cast(JSON_EXTRACT_SCALAR(prices, '$.astar.usd') as double) AS token_priceFROM responseUNION ALLSELECT 'USDC' AS currency, 1 as token_priceFROM response)selectevt_block_date as date,count(distinct buyer) as unique_buyers,sum(quantityBought) as num_sales,round(avg(totalPricePaid * t.token_price), 3) as avg_price,round(sum(quantityBought * totalPricePaid * t.token_price), 2) as volume,tokenNamefrom query_4898824 as sleft join token_prices ton s.currency = t.currencygroup by evt_block_date, tokenNameorder by evt_block_date desc