Query editor
WITH changed_prices AS (SELECTblock_time,block_time - INTERVAL '1' second as period_start,LEAD(block_time) OVER (PARTITION BY asset_id ORDER BY block_time ASC) as period_end,condition_id,asset_id AS token_id,priceFROM polymarket_polygon.market_trades_rawWHERE asset_id = CAST('26395152648300797717473284885867984429665155581904029757847400906536688206860' AS uint256)),filled_prices AS (SELECTcp.*,COALESCE(period_end,block_time + INTERVAL '1' second -- For the last record, extend 1 second) as effective_endFROM changed_prices cp)SELECTblock_time as price_update_time,period_start,effective_end,condition_id,token_id,price,-- Add time-based calculations if neededDATE_DIFF('second', period_start, effective_end) as duration_secondsFROM filled_pricesWHERE price > 0ORDER BY block_time desc