Query editor
WITH daily_metrics AS (SELECTDATE_TRUNC('day', block_time) AS day,COUNT(DISTINCT tx_hash) AS transactions,COUNT(DISTINCT taker) AS active_users,SUM(amount_usd) AS volume_usd,AVG(amount_usd) AS avg_trade_size_usdFROM dex.tradesWHERE blockchain = 'avalanche_c'AND project = 'blackhole'AND block_time >= TIMESTAMP '2025-07-21'AND taker IS NOT NULLGROUP BY 1),all_users AS (SELECT DISTINCT taker AS user_addressFROM dex.tradesWHERE blockchain = 'avalanche_c'AND project = 'blackhole'AND block_time >= TIMESTAMP '2025-07-21'AND taker IS NOT NULL)SELECTCOUNT(DISTINCT day) AS days_active,SUM(transactions) AS total_transactions,COUNT(*) AS total_unique_users,SUM(volume_usd) AS total_volume_usd,AVG(volume_usd) AS avg_daily_volume_usd,AVG(active_users) AS avg_daily_active_users,AVG(avg_trade_size_usd) AS avg_trade_size_usd,SUM(volume_usd) / NULLIF(SUM(transactions), 0) AS avg_transaction_valueFROM daily_metricsCROSS JOIN (SELECT COUNT(*) AS total_users FROM all_users) u;