/topbets showed ends 1970-01-01 for some markets. Root cause: the data-api positions feed returns an epoch placeholder 1970-01-01 as the market endDate when the real end date lives on the gamma event, not the market. Fixed by capturing the event end date and falling back to it. Shipped 2026-06-08.
Symptom
/topbets rendered ends 1970-01-01 for certain markets.
Root cause
Epoch placeholder for event-dated markets
The data-api positions feed returns
endDate = 1970-01-01(the Unix epoch placeholder) for markets whose end date lives on the gamma EVENT rather than the market — the market-levelendDateis null, and the feed serializes that null as the epoch. So the bug only hit markets that inherit their date from their parent event.
Fix (4 parts)
- Capture the event end_date. The category sync now reads the gamma event
endDateinto a new columnpmv2_event_category.end_date(migration20260608000000).event_tagsnow returnsend_date;upsert_event_categorystores it. - Normalize the placeholder to NULL.
map_positionrunsnormalize_end_date, which drops empty / pre-2000 dates (so the1970-01-01epoch becomesNULLrather than a fake date). - COALESCE to the event date. The 3 cohort-holder queries use
COALESCE(p.end_date, ec.end_date)so epoch-placeholder markets fall back to the real event date from the category cache. - Display unresolved past-dated held markets.
/topbetsmarks a still-held but past-dated market asends {date} (unresolved)(viaend_date_seg, usingsnapshot_tsto decide past-vs-future).
Verified vs prod
| market | resolved end date |
|---|---|
| kansas-governor | 2026-11-03 |
| openai-ipo | 2026-12-31 |
Distinct from the earlier countdown end_date issue
This is not the correctness-pass deferred item (date-only
end_dateparsed as UTC midnight → countdown ≤24h off). That was a timezone/parsing issue on a present date; this is an epoch-placeholder + wrong source issue. Different bug, different fix.
Scoring/ranking untouched
Only end_date metadata + display changed. The pmv2 scoring/ranking path is not affected.
Related
- self-sync-held-only-fix — shipped the same day; shares the past-date root-cause class (still-held bets on past-but-unresolved markets)
- correctness-pass-six-fix-commits — the other, distinct end_date issue (UTC-midnight countdown), deferred there
- pmv2-topbets-categories-filters —
/topbets+ thepmv2_event_categorycache this extends - pmv2-gamma-tags-categorization — the gamma
/eventssource the event end_date comes from - polymarket-fetch