Query editor
--dormant and active accounts-- if I extend the timeframe to several months should I track cumulative dormant times to see when addresses jump to be active (flat line)?with prev as (---- 1 load previous results (empty on first run)select * from TABLE(previous.query.result(schema => DESCRIPTOR(block_time TIMESTAMP(3),blockchain VARCHAR,symbol VARCHAR,nbr_trades DOUBLE,sum_amount BIGINT,avg_amount DOUBLE,var_amount DOUBLE,total_dormant_time BIGINT,avg_dormant_time DOUBLE,var_dormant_time DOUBLE )))), checkpoint AS (-- 2 find where compute was left off (with X day lookback for incomplete data)select COALESCE(max(block_time), TIMESTAMP '2022-01-01') - INTERVAL '1' DAY as cutoffFROM prev), evm_add as (select distinct from_hex(contract_address) as contract_address from query_7529059 where chain NOT IN ('Solana', 'Stellar'))-- HISTORICAL STATS {before lookback window}-- past_blockchain_dataselectblock_time, symbol, blockchain as blockchain, "from" as wallets, amount -- focus on EUR stablecoins. so all amounts are EUR, lag(block_time,1 ) over (partition by "from", blockchain, symbol order by block_time asc) as prev_transactionsfrom tokens.transferswhere contract_address IN (select contract_address from evm_add)and amount > 0 -- exclude fake phising attemptsand block_time < (select cutoff from checkpoint)-- exclude mints and burnsand "from" <> 0x0000000000000000000000000000000000000000and "to" <> 0x0000000000000000000000000000000000000000group by "from", blockchain, symbol, block_time, amountunion allselectblock_time, symbol, blockchain, "from" as wallets, amount -- focus on EUR stablecoins. so all amounts are EUR, lag(block_time,1 ) over (partition by "from", blockchain, symbol order by block_time asc) as prev_transactionsfrom tokens.transferswhere contract_address IN (select contract_address from evm_add)and amount > 0 -- exclude fake phising attemptsand block_time >= (select cutoff from checkpoint)