Query editor
withbase_contract_creation as(selectcontract_address, min(block_time) as contract_created_atfrom evms.logsgroup by 1),base_token_prices as(select * from query_3735110), -- This query contains derived Token Pricesbase_transfers as(SELECTa.blockchain,a.evt_block_time,date(a.evt_block_time) as block_date,a.evt_tx_hash,a.contract_address AS contract_address,cast(a.value as double)/conversion as quantity,(cast(a.value as double)/conversion)*price as volume,b.price,max(evt_block_time) over(partition by a.blockchain, a.contract_address) as last_transaction_atFROM evms.erc20_transfers aleft join base_token_prices b on a.blockchain = b.blockchain and a.contract_address = b.contract_address and date(a.evt_block_time) = b.block_dateWHERE 1=1and a.evt_block_time > CAST(NOW() - INTERVAL '4' day as timestamp)and b.contract_address is not null),base_time_diff as(select *, date_diff('hour', evt_block_time, last_transaction_at) as diff_hours from base_transfers),base_summary as(selectblockchain,contract_address,max(block_date) as max_block_date,max(last_transaction_at) as last_transaction_at,count(distinct case when diff_hours >= 0 and diff_hours < 24 then evt_tx_hash end) as transactions_0_24h,count(distinct case when diff_hours >= 24 and diff_hours < 48 then evt_tx_hash end) as transactions_24_48h,sum(case when diff_hours >= 0 and diff_hours < 24 then volume end) as volume_0_24h,sum(case when diff_hours >= 24 and diff_hours < 48 then volume end) as volume_24_48h,approx_percentile(case when diff_hours >= 0 and diff_hours < 24 then price end, 0.5) as median_price_0_24h,approx_percentile(case when diff_hours >= 24 and diff_hours < 48 then price end, 0.5) as median_price_24_48hfrom base_time_diffwhere volume > 0group by 1,2),base_filter as(select*,(transactions_0_24h - transactions_24_48h)*100.00/transactions_24_48h as perc_change_transactions,(volume_0_24h - volume_24_48h)*100.00/volume_24_48h as perc_change_volume,(median_price_0_24h - median_price_24_48h)*100.00/median_price_24_48h as perc_change_pricefrom base_summarywhere 1=1and max_block_date = date(now())and transactions_0_24h > 1000and transactions_24_48h > 100and volume_0_24h > 10000