Query editor
-- Panel 5: Aggregate headline (no parameter)-- Copy-follower patterns across the top 500 traders by 30 day token-buy volume on arbitrum, base, bnb.-- Rule: a follower's first buy of a token lands within 60 seconds after a top trader's first buy of it, on 3+ distinct tokens.with quote_tokens as (select t from (values(0x82af49447d8a07e3bd95bd0d56f35241523fbab1), -- WETH arbitrum(0x4200000000000000000000000000000000000006), -- WETH base(0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c), -- WBNB(0x55d398326f99059ff775485246999027b3197955), -- USDT bnb(0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9), -- USDT arbitrum(0xaf88d065e77c8cc2239327c5edb3a432268e5831), -- USDC arbitrum(0xff970a61a04b1ca14834a43f5de4533ebddb5cc8), -- USDC.e arbitrum(0x833589fcd6edb6e08f4c7c32d4f71b54bda02913), -- USDC base(0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d), -- USDC bnb(0xe9e7cea3dedca5984780bafc599bd69add087d56), -- BUSD bnb(0x8d0d000ee44948fc98c9b98a4fa4921476f08b0d), -- USD1 bnb(0xda10009cbd5d07dd0cecc66161fc93d7c9000da1), -- DAI arbitrum(0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f), -- WBTC arbitrum(0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c) -- BTCB bnb) as x(t)),-- all token buys (non quote token bought) in the windowbuys as (select blockchain, taker, token_bought_address as token, block_time, amount_usdfrom dex.tradeswhere blockchain in ('arbitrum','base','bnb')and block_month >= date_trunc('month', current_date - interval '30' day)and block_date >= current_date - interval '30' dayand token_bought_address not in (select t from quote_tokens)),-- first buy (entry) of each token per walletentries as (select blockchain, taker, token,min(block_time) as entry_time,min_by(amount_usd, block_time) as entry_usd,cast(floor(to_unixtime(min(block_time)) / 60) as bigint) as bfrom buysgroup by 1, 2, 3),top_traders as (select taker as leader, sum(amount_usd) as volume_usdfrom buysgroup by 1having count(distinct token) >= 3order by 2 desclimit 500),leader_entries as (select e.blockchain, e.taker as leader, e.token, e.entry_time, e.bfrom entries ejoin top_traders l on l.leader = e.taker),-- minute-bucket keys so the self-join is an equi-join (entry within 60s spans at most 2 buckets)leader_keys as (select blockchain, leader, token, entry_time, b from leader_entriesunion allselect blockchain, leader, token, entry_time, b + 1 from leader_entries),pairs as (select e.taker as follower, m.leader, e.blockchain, e.token, e.entry_usd,