Query editor
WITH wallets(label,wallet) AS (VALUES('5422',0x5422ee0965a121f0197c6885d4a373115f7eb418),('e957',0xe957a99f5134e7129c30ff87c173b536a38188f2)),factory AS (SELECT address token,MIN(block_time) creation_timeFROM robinhood.creation_tracesWHERE "from"=0xd9ec2db5f3d1b236843925949fe5bd8a3836fccbAND block_month=DATE '2026-07-01'AND block_time>=TIMESTAMP '2026-07-08'AND block_time<TIMESTAMP '2026-07-12'GROUP BY 1),dex_raw AS (SELECT token_bought_address token,block_time,tx_hash,tx_from,amount_usd,1 is_buyFROM dex.tradesWHERE blockchain='robinhood'AND block_month=DATE '2026-07-01'AND block_date>=DATE '2026-07-08' AND block_date<DATE '2026-07-12'AND token_bought_address IS NOT NULLUNION ALLSELECT token_sold_address token,block_time,tx_hash,tx_from,amount_usd,0 is_buyFROM dex.tradesWHERE blockchain='robinhood'AND block_month=DATE '2026-07-01'AND block_date>=DATE '2026-07-08' AND block_date<DATE '2026-07-12'AND token_sold_address IS NOT NULL),dex_legs AS (SELECT token,block_time,tx_hash,MAX(tx_from) tx_from,MAX(amount_usd) amount_usd,MAX(is_buy) is_buyFROM dex_rawGROUP BY 1,2,3),first_dex AS (SELECT d.token,MIN(d.block_time) first_dex_timeFROM dex_legs d JOIN factory f ON f.token=d.tokenWHERE d.block_time>=f.creation_timeGROUP BY 1),eligible AS (SELECT f.token,f.creation_time,x.first_dex_timeFROM factory f JOIN first_dex x ON x.token=f.tokenWHERE x.first_dex_time<TIMESTAMP '2026-07-11 23:50:00'),activity AS (SELECT e.token,e.first_dex_time,COUNT(DISTINCT IF(DATE_DIFF('second',e.first_dex_time,d.block_time)<=60,d.tx_hash,NULL)) txs_60,COUNT(DISTINCT IF(DATE_DIFF('second',e.first_dex_time,d.block_time)<=180,d.tx_hash,NULL)) txs_180,COUNT(DISTINCT IF(DATE_DIFF('second',e.first_dex_time,d.block_time)<=300,d.tx_hash,NULL)) txs_300,COUNT(DISTINCT IF(DATE_DIFF('second',e.first_dex_time,d.block_time)<=600,d.tx_hash,NULL)) txs_600,COUNT(DISTINCT IF(DATE_DIFF('second',e.first_dex_time,d.block_time)<=300,d.tx_from,NULL)) traders_300,SUM(IF(DATE_DIFF('second',e.first_dex_time,d.block_time)<=300,COALESCE(d.amount_usd,0e0),0e0)) volume_300,COUNT(DISTINCT IF(DATE_DIFF('second',e.first_dex_time,d.block_time)<=300 AND d.is_buy=1,d.tx_hash,NULL)) buys_300,COUNT(DISTINCT IF(DATE_DIFF('second',e.first_dex_time,d.block_time)<=300 AND d.is_buy=0,d.tx_hash,NULL)) sells_300FROM eligible e JOIN dex_legs d ON d.token=e.tokenWHERE d.block_time>=e.first_dex_timeGROUP BY 1,2