Query editor
-- Token Volume Ranking: Most traded tokens on TONCO-- Returns: Token-level volume metrics (both as sold and bought)WITH token_activity AS (-- Tokens soldSELECTtoken_sold_address AS token_address,'sold' AS direction,volume_usd,tx_hash,block_dateFROM ton.dex_tradesWHERE project = 'tonco'AND block_date >= CURRENT_DATE - INTERVAL '30' DAYUNION ALL-- Tokens boughtSELECTtoken_bought_address AS token_address,'bought' AS direction,volume_usd,tx_hash,block_dateFROM ton.dex_tradesWHERE project = 'tonco'AND block_date >= CURRENT_DATE - INTERVAL '30' DAY),token_stats AS (SELECTtoken_address,COUNT(DISTINCT tx_hash) AS total_trades,SUM(volume_usd) AS total_volume,SUM(CASE WHEN direction = 'sold' THEN volume_usd ELSE 0 END) AS sell_volume,SUM(CASE WHEN direction = 'bought' THEN volume_usd ELSE 0 END) AS buy_volume,COUNT(DISTINCT CASE WHEN direction = 'sold' THEN tx_hash END) AS sell_trades,COUNT(DISTINCT CASE WHEN direction = 'bought' THEN tx_hash END) AS buy_trades,COUNT(DISTINCT block_date) AS active_daysFROM token_activityGROUP BY token_address)SELECT*FROM (SELECT DISTINCTCASE ts.token_addressWHEN '0:0000000000000000000000000000000000000000000000000000000000000000' THEN 'TON'ELSE COALESCE(jm.symbol, 'UNKNOWN')END AS token_symbol,CASE ts.token_addressWHEN '0:0000000000000000000000000000000000000000000000000000000000000000' THEN 'Toncoin'ELSE COALESCE(jm.name, 'Unknown Token')END AS token_name,CASEWHEN ts.token_address = '0:0000000000000000000000000000000000000000000000000000000000000000' THENCONCAT('<a href="https://tonscan.org/jetton/',ts.token_address,