Query editor
WITH info AS (SELECTblockchain, version, block_time, token_bought_symbol, token_sold_symbol,token_pair, token_bought_amount, token_sold_amount, amount_usd,token_bought_address, token_sold_address, taker, maker,project_contract_address, tx_hashFROMdex.tradesWHEREproject = 'uniswap'),tokens AS (SELECTdate_trunc('month', block_time) AS month,token_bought_symbol AS symbol,amount_usd,tx_hashFROMinfoUNION ALLSELECTdate_trunc('month', block_time) AS month,token_sold_symbol AS symbol,amount_usd,tx_hashFROMinfo),TokenStats AS (SELECTmonth,symbol,SUM(amount_usd) AS USD_Volume,approx_distinct(tx_hash) AS tx_countFROMtokensWHEREmonth > DATE '2020-06-29'GROUP BYmonth, symbol),TokenCategories AS (SELECTmonth,symbol,tx_count,USD_Volume,CASEWHEN tx_count < 100 AND USD_Volume < 100 THEN 'not actively traded'WHEN tx_count < 100 AND USD_Volume >= 100 THEN 'counts not active'WHEN tx_count >= 100 AND USD_Volume < 100 THEN 'volume not active'ELSE 'active'END AS trade_categoryFROMTokenStats)SELECTmonth,trade_category,COUNT(DISTINCT symbol) AS token_count