Query editor
-- Resolved Markets and Winning Outcomes-- Essential for tracking which predictions have completed and which side won, limited to the top 20 by total trading volume.WITH market_total_volume AS (-- Calculate the total trading volume for each market's condition IDSELECTcondition_id, SUM(amount) AS total_market_volume_usdFROMpolymarket_polygon.market_tradesGROUP BY1)SELECT-- Market resolution timet1.block_time AS resolution_time-- The unique question identifier, t1.question_id-- The winning outcome (e.g., 'Yes' or 'No'), t1.outcome AS winning_outcome_name-- Market question from the details table, t2.question AS market_question, t2.event_market_name-- Include the calculated volume for display, mv.total_market_volume_usdFROMpolymarket_polygon.market_outcomes t1INNER JOINpolymarket_polygon.market_details t2 ON t1.question_id = t2.question_idINNER JOINmarket_total_volume mv ON t2.condition_id = mv.condition_id -- Join to the volume calculationORDER BYmv.total_market_volume_usd DESC -- Order by volume in descending orderLIMIT 40 -- Limits the result set to the top 20 resolved markets by volume