Query editor
with wallets_to_routers as (select tx_from as wallet,min(block_time) as first_tradefrom dex.tradeswhere tx_to in(0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45, -- uni0xE592427A0AEce92De3Edee1F18E0157C05861564,0x7a250d5630b4cf539739df2c5dacb4c659f2488d,0xf164fC0Ec4E93095b804a4795bBe1e041497b92a,0xEf1c6E67703c7BD7107eed8303Fbe6EC2554BF6B,0x4C60051384bd2d3C01bfc845Cf5F4b44bcbE9de5,0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD)and blockchain = 'ethereum'and date_trunc('week', now()) >= block_time -- cut unfinished weeksgroup by 1), tx as (select e.from_tx,e.block_time,w.walletfrom (select "from" as from_tx,block_timefrom ethereum.transactions) eleft join wallets_to_routers won e.from_tx = w.wallet), first_tx as (select wallet,min(block_time) as first_txfrom txwhere wallet is not NULLgroup by 1), tx_groups as (select case when first_trade = first_tx then -2when round(date_diff('day', first_tx, first_trade), 0) <= 1 then -1else round(date_diff('month', first_tx, first_trade), 0)end as creation_from_time,date_trunc('week', first_trade) as week_of_first_trade,count(*) as total_tradesfrom wallets_to_routers wleft join first_tx fon f.wallet = w.walletgroup by 1, 2)select case when creation_from_time = -2 then 'First Tx'when creation_from_time = -1 then 'First Day'when creation_from_time = 0 then 'Same month'when creation_from_time = 1 then 'Previous month'when creation_from_time >= 2 and creation_from_time <= 6 then '2-6 months ago'when creation_from_time >= 7 and creation_from_time <= 12 then '6-12 months ago'when creation_from_time >= 13 and creation_from_time <= 24 then '12-24 months ago'else '24+ months ago'end as time_after_wallet_creation,week_of_first_trade,total_tradesfrom tx_groupsorder by creation_from_time