Query editor
-- 04 · Calibration: what did the market price before resolution, and what happened?-- One row per resolved yes/no market per horizon (90/30/7/1 days before settlement).-- Reads the classifier: https://dune.com/queries/9226505-- Caveat: Polymarket settlement_ts can lag the real-world outcome by days, so the 1-day-- horizon may already reflect the answer. Lean on the 7- and 30-day horizons.with mk as (select theme, sub_theme, venue, market_id, question, resolved_outcome, settlement_ts, market_start_timefrom query_9226505where resolved_outcome in ('yes', 'no')and settlement_ts is not nulland not looks_like_price_market),horizons (days_before) as (values 1, 7, 30, 90),px as (selectmk.venue, mk.market_id, h.days_before,max_by(o.close, o.hour) filter (where not o.is_forward_filled) as last_traded_prob_yes,max(o.hour) filter (where not o.is_forward_filled) as last_trade_hour,sum(o.volume_contracts) as volume_notional_to_horizon_usdfrom mkcross join horizons hjoin prediction_markets.ohlcv_hourly oon o.venue = mk.venueand o.market_id = mk.market_idand o.hour <= mk.settlement_ts - h.days_before * interval '1' daywhere o.block_month >= date '2022-01-01'group by 1, 2, 3)selectmk.theme, mk.sub_theme, mk.venue, mk.question,mk.resolved_outcome,case when mk.resolved_outcome = 'yes' then 1 else 0 end as outcome_yes,px.days_before,px.last_traded_prob_yes,power(px.last_traded_prob_yes - case when mk.resolved_outcome = 'yes' then 1 else 0 end, 2)as brier_score,date_diff('hour', px.last_trade_hour, mk.settlement_ts - px.days_before * interval '1' day)as price_staleness_hours,px.volume_notional_to_horizon_usd,mk.market_start_time, mk.settlement_ts, mk.market_idfrom mkjoin px on px.venue = mk.venue and px.market_id = mk.market_idwhere px.last_traded_prob_yes is not nullorder by mk.settlement_ts, mk.market_id, px.days_before desc