Query editor
-- 03 · Daily implied probability (Yes) for the top 40 markets by lifetime notional volume-- Reads the classifier: https://dune.com/queries/9226505-- close_prob_yes includes carried-forward closes; check day_has_trades before reading a move as real.with mk as (select theme, sub_theme, venue, market_id, question, resolved_outcomefrom query_9226505where not looks_like_price_market),hourly as (select o.venue, o.market_id, o.hour, o.close, o.vwap, o.volume_contracts, o.is_forward_filledfrom prediction_markets.ohlcv_hourly ojoin mk on mk.venue = o.venue and mk.market_id = o.market_idwhere o.block_month >= date '2022-01-01'),top_mk as (select venue, market_id, sum(volume_contracts) as lifetime_notional_usdfrom hourlygroup by 1, 2order by 3 desclimit 40)selectdate_trunc('day', h.hour) as day,mk.theme, mk.sub_theme, mk.venue, mk.question, mk.resolved_outcome,max_by(h.close, h.hour) as close_prob_yes,sum(h.volume_contracts * h.vwap) / nullif(sum(case when h.vwap is not null then h.volume_contracts end), 0)as vwap_prob_yes,sum(h.volume_contracts) as volume_notional_usd,bool_or(not h.is_forward_filled) as day_has_trades,t.lifetime_notional_usd,mk.market_idfrom hourly hjoin top_mk t on t.venue = h.venue and t.market_id = h.market_idjoin mk on mk.venue = h.venue and mk.market_id = h.market_idgroup by 1, 2, 3, 4, 5, 6, 11, 12order by mk.market_id, day