Query editor
with eth as (with raw_data as (select json_parse(http_get('https://api.dexscreener.com/latest/dex/pairs/ethereum/0x00b9edc1583bf6ef09ff3a09f6c23ecb57fd7d0bb75625717ec81eed181e22d7')) as json_data),pair_data as (selectjson_extract_scalar(json_data, '$.pair.priceUsd') as price_usdfrom raw_data)selectcast(price_usd as double) as price_usdfrom pair_data),tx_data as (select"from" as wallet,date_trunc('week', block_time) as tx_week,count(*) as tx_count,sum(value / 1e18) * (select price_usd from eth) as total_volumefrom ethereum.transactionswhere 1=1and block_time >= now() - interval '365' day -- last 1 yeargroup by 1, 2having count(*) > 0),data as (selectwallet,sum(tx_count) as tx_count_365d,sum(total_volume) as total_volume,count(distinct tx_week) as active_weeksfrom tx_datagroup by wallethaving sum(total_volume) > 0),min_median_avg_metrics as (selectmin(tx_count_365d) as min_tx_count,approx_percentile(tx_count_365d, 0.5) as median_tx_count,avg(tx_count_365d) as avg_tx_count,min(total_volume) as min_total_volume,approx_percentile(total_volume, 0.5) as median_total_volume,avg(total_volume) as avg_total_volume,min(active_weeks) as min_active_weeks,approx_percentile(active_weeks, 0.5) as median_active_weeks,avg(active_weeks) as avg_active_weeks