Query editor
WITH daily_volume AS (SELECTDATE_TRUNC('day', t.block_time) AS trade_date,COUNT(*) AS num_trades,COUNT(DISTINCT t.tx_id) AS num_transactions,COUNT(DISTINCT t.trader_id) AS unique_traders,SUM(t.amount_usd) AS total_volume_usd,AVG(t.amount_usd) AS avg_trade_size_usdFROM dex_solana.trades tINNER JOIN solana.instruction_calls iON t.tx_id = i.tx_idAND t.block_time = i.block_timeWHEREi.executing_account = 'cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG'AND ARRAY_JOIN(i.account_arguments, ',') LIKE '%59WuweKV7DAg8aUgRhNytScQxioaFYNJdWnox5FxAXFq%'AND t.block_time >= TIMESTAMP '2025-10-09'GROUP BY 1ORDER BY 1 DESC)SELECTtrade_date,total_volume_usd,num_trades,unique_traders,-- Estimated fees (adjust fee_rate: 0.0025 = 0.25% = 25 bps)total_volume_usd * 0.005 AS estimated_total_fees_usd,-- LP receives ~80% after protocol feetotal_volume_usd * 0.005 * 0.80 AS estimated_lp_fees_usd,-- Protocol receives ~20%total_volume_usd * 0.005 * 0.20 AS estimated_protocol_fees_usd,-- Cumulative LP feesSUM(total_volume_usd * 0.005 * 0.80) OVER (ORDER BY trade_date) AS cumulative_lp_fees_usdFROM daily_volumeORDER BY trade_date DESC;