Query editor
--- query_4898824: #sonieum-newsalewith token_prices AS (SELECT'ETH' AS currency, 1 AS token_priceFROM (SELECT 1 LIMIT 1)UNION ALLSELECT'WETH' AS currency, 1 AS token_priceFROM (SELECT 1 LIMIT 1)UNION ALLSELECT 'ASTR' AS currency, cast(JSON_EXTRACT_SCALAR(prices.price_data, '$.astar.eth') as double) AS token_priceFROM (SELECT http_get('https://api.coingecko.com/api/v3/simple/price?ids=astar,usd&vs_currencies=eth') AS price_data FROM (SELECT 1 LIMIT 1)) AS pricesUNION ALLSELECT'USDC' AS currency,token_pricefrom (select(1 / (price * 1.0)) AS token_pricefrom prices.usd_latestwhere symbol = 'WETH'and blockchain = 'base')-- SELECT 'USDC' AS currency, cast(JSON_EXTRACT_SCALAR(prices.price_data, '$.usd.eth') as double) AS token_price-- FROM (SELECT http_get('https://api.coingecko.com/api/v3/simple/price?ids=astar,usd&vs_currencies=eth') AS price_data FROM (SELECT 1 LIMIT 1)) AS prices)selectsum(quantityBought) as num_sales,round(sum(quantityBought * totalPricePaid * t.token_price), 2) as volume,count(distinct buyer) as buyers,count(distinct listingCreator) as sellers,round(sum(quantityBought) / count(distinct buyer),2) as avg_purchase_per_user,count(distinct assetContract) as num_collections,round(sum(quantityBought * totalPricePaid * t.token_price)/count(distinct evt_block_date),2) as avg_daily_volume,sum(case when tokenType = 'ERC-1155' then 1 else 0 end) as erc_1155,sum(case when tokenType = 'ERC-721' then 1 else 0 end) as erc_721from query_4898824 as sleft join token_prices ton s.currency = t.currency