Query editor
WITH res AS (SELECT conditionId AS condition_id FROM polymarket_polygon.ctf_evt_conditionresolutionWHERE cardinality(payoutNumerators)=2AND array_join(transform(payoutNumerators,x->cast(x AS varchar)),',') IN ('1,0','0,1')),md AS (SELECT lower(condition_id) AS cid, max(try_cast(substr(market_end_time,1,10) AS date)) AS sched_dateFROM polymarket_polygon.market_detailsWHERE market_end_time IS NOT NULL AND market_end_time <> '' GROUP BY lower(condition_id)),tr AS (SELECT t.condition_id, t.token_outcome, t.amount, t.shares,date_diff('day', cast(t.block_time AS date), md.sched_date) AS dteFROM polymarket_polygon.market_trades tJOIN res r ON r.condition_id=t.condition_idJOIN md ON md.cid = lower('0x'||to_hex(t.condition_id))WHERE t.token_outcome IN ('Yes','No') AND t.amount>0 AND md.sched_date IS NOT NULLAND t.block_month >= DATE '2026-03-01' AND t.block_month < DATE '2026-04-01')SELECT '0x'||to_hex(condition_id) AS cid, sum(amount) AS vol, min(dte) AS min_dte, max(dte) AS max_dte,round(sum(CASE WHEN token_outcome='Yes' AND dte BETWEEN 8 AND 14 THEN amount END)/ nullif(sum(CASE WHEN token_outcome='Yes' AND dte BETWEEN 8 AND 14 THEN shares END),0),4) AS vwap_8_14dFROM tr GROUP BY condition_id HAVING sum(amount)>=10000 LIMIT 12