Query editor
-- created with github.com/ohld/ton-analyst-- TON wallets by average transactions PER DAY over their own lifetime.-- "Wallet" = account with a wallet_* interface in ton.accounts.-- "Lifetime" = first_day..last_day of its own transactions, inclusive (a one-day wallet = 1 day).-- "tx_per_day" = lifetime tx count / lifetime days.-- "Fee" = ton.transactions.total_fees charged to that account;-- fees_with_fwd_ton adds the sender-paid forward fee to the destination shard.WITH wallets AS (SELECT addressFROM ton.accountsWHERE cardinality(FILTER(interfaces, i -> regexp_like(i, '^wallet_'))) > 0),per_wallet AS (SELECTt.account AS address,COUNT(*) AS tx_count,MIN(t.block_date) AS first_day,MAX(t.block_date) AS last_day,SUM(t.total_fees) AS fees_nano,SUM(COALESCE(t.action_total_fwd_fees, 0) - COALESCE(t.action_total_action_fees, 0)) AS fwd_nanoFROM ton.transactions tJOIN wallets w ON w.address = t.accountGROUP BY 1),rated AS (SELECT*,date_diff('day', first_day, last_day) + 1 AS active_days,CAST(tx_count AS double) / (date_diff('day', first_day, last_day) + 1) AS tx_per_dayFROM per_wallet)SELECTCASEWHEN tx_per_day > 5 THEN 'more than 5 tx/day'WHEN tx_per_day = 5 THEN 'exactly 5 tx/day'ELSE 'less than 5 tx/day'END AS cohort,COUNT(*) AS wallets,SUM(tx_count) AS transactions,SUM(fees_nano) / 1e9 AS fees_ton,SUM(fees_nano + fwd_nano) / 1e9 AS fees_with_fwd_ton,SUM(fees_nano) / 1e9 / COUNT(*) AS avg_fees_ton_per_wallet,AVG(tx_per_day) AS avg_tx_per_day,APPROX_PERCENTILE(tx_per_day, 0.5) AS median_tx_per_day,AVG(CAST(active_days AS double)) AS avg_active_days,APPROX_PERCENTILE(CAST(active_days AS double), 0.5) AS median_active_days,AVG(CAST(tx_count AS double)) AS avg_tx_countFROM ratedGROUP BY 1ORDER BY 2 DESC