Query editor
WITH daily_metrics AS (SELECTDATE_TRUNC('day', block_time) AS day,COUNT(DISTINCT tx_hash) AS transactions,COUNT(DISTINCT taker) AS daily_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'GROUP BY 1),total_users AS (SELECT COUNT(DISTINCT taker) AS total_unique_usersFROM dex.tradesWHERE blockchain = 'avalanche_c'AND project = 'blackhole'AND block_time >= TIMESTAMP '2025-07-21')SELECTCOUNT(DISTINCT day) AS days_active,SUM(transactions) AS total_transactions,MAX(tu.total_unique_users) AS total_unique_users,SUM(volume_usd) AS total_volume_usd,AVG(volume_usd) AS avg_daily_volume_usd,AVG(daily_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_metrics dmCROSS JOIN total_users tu;