Markets and Events Source
Exact documentation of the Gamma market and event endpoints that feed the PolyLab market snapshot.
This page is intentionally explicit and implementation-first. If the product or upstream APIs change, the current behavior described here can change with them.
Upstream endpoints
PolyLab fetches market and event data from:
https://gamma-api.polymarket.com/marketshttps://gamma-api.polymarket.com/events
Current request shape
The market fetcher pages through both endpoints with these parameters:
| Endpoint | Parameters |
|---|---|
/markets | active=true, closed=false, archived=false, limit, offset, enableOrderBook=false |
/events | active=true, closed=false, archived=false, limit, offset |
Why enableOrderBook=false matters
PolyLab is not fetching or storing a live order-book view in this path. The scanner is built around market snapshot fields, not an execution-grade order-book model.
What comes from /events
The events payload is used for:
slugiconorimagetags
Those values are then used to enrich market rows with:
event_slugicon_urltag_labelrows inmarket_tags- primary
category
What comes from /markets
The markets payload is used for:
- market id
- condition id
- question
- outcomes
- outcome prices
- spread
- volume
- liquidity
- start and end date
- market-level fallback slug and icon fields
Event resolution and fallbacks
PolyLab first looks for the first nested event in m["events"][0]. If that event can be resolved in the fetched event map, it uses the event-level slug, icon, and tags.
If not, it falls back to:
- nested event slug/icon directly
- then market-level slug/icon
Per-outcome expansion
Markets are not stored one row per market. PolyLab expands the outcomes array and outcomePrices array into one row per outcome in active_market_outcomes.
That is why the scanner naturally sorts and filters outcome rows.