Query editor
with diario as (-- Ășltimo snapshot de cada dia, por mercadoselectcast(snapshot_ts as date) as dia,symbol,open_interest_usd,row_number() over (partition by cast(snapshot_ts as date), symbolorder by snapshot_ts desc) as nfrom dune.theosq.lighter_markets_dailywhere status = 'active'),ranqueado as (selectdia,symbol,open_interest_usd,row_number() over (partition by dia order by open_interest_usd desc) as rank,sum(open_interest_usd) over (partition by dia) as oi_totalfrom diariowhere n = 1)selectdia,max(oi_total) as oi_total_usd,round(100.0 * sum(case when rank <= 3 then open_interest_usd end) / max(oi_total), 2) as share_top3_pct,round(100.0 * sum(case when rank <= 10 then open_interest_usd end) / max(oi_total), 2) as share_top10_pct,count(case when open_interest_usd > 0 then 1 end) as mercados_com_oifrom ranqueadogroup by diaorder by dia