Update Polymarket documentation (2026-02-19)
- Added new documentation URLs from llms.txt index - Updated TARGET.md with 244 total documentation pages - Scraped new pages for trading, concepts, and API reference sections - Updated changelog and new index pages
This commit is contained in:
@@ -2,76 +2,80 @@
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# How to Fetch Markets
|
||||
# Fetching Markets
|
||||
|
||||
<Tip>Both the getEvents and getMarkets are paginated. See [pagination section](#pagination) for details.</Tip>
|
||||
This guide covers the three recommended approaches for fetching market data from the Gamma API, each optimized for different use cases.
|
||||
> Three strategies for discovering and querying markets
|
||||
|
||||
## Overview
|
||||
<Tip>
|
||||
Both the events and markets endpoints are paginated. See
|
||||
[pagination](#pagination) for details.
|
||||
</Tip>
|
||||
|
||||
There are three main strategies for retrieving market data:
|
||||
There are three main strategies for retrieving market data, each optimized for different use cases:
|
||||
|
||||
1. **By Slug** - Best for fetching specific individual markets or events
|
||||
2. **By Tags** - Ideal for filtering markets by category or sport
|
||||
3. **Via Events Endpoint** - Most efficient for retrieving all active markets
|
||||
1. **By Slug** — Best for fetching specific individual markets or events
|
||||
2. **By Tags** — Ideal for filtering markets by category or sport
|
||||
3. **Via Events Endpoint** — Most efficient for retrieving all active markets
|
||||
|
||||
***
|
||||
|
||||
## 1. Fetch by Slug
|
||||
## Fetch by Slug
|
||||
|
||||
**Use Case:** When you need to retrieve a specific market or event that you already know about.
|
||||
**Use case:** When you need to retrieve a specific market or event that you already know about.
|
||||
|
||||
Individual markets and events are best fetched using their unique slug identifier. The slug can be found directly in the Polymarket frontend URL.
|
||||
|
||||
### How to Extract the Slug
|
||||
|
||||
From any Polymarket URL, the slug is the path segment after `/event/` or `/market/`:
|
||||
From any Polymarket URL, the slug is the path segment after `/event/`:
|
||||
|
||||
```
|
||||
https://polymarket.com/event/fed-decision-in-october?tid=1758818660485
|
||||
↑
|
||||
Slug: fed-decision-in-october
|
||||
https://polymarket.com/event/fed-decision-in-october
|
||||
↑
|
||||
Slug: fed-decision-in-october
|
||||
```
|
||||
|
||||
### API Endpoints
|
||||
|
||||
**For Events:** [GET /events/slug/{slug}](/api-reference/events/list-events)
|
||||
|
||||
**For Markets:** [GET /markets/slug/{slug}](/api-reference/markets/list-markets)
|
||||
|
||||
### Examples
|
||||
|
||||
```bash theme={null}
|
||||
# Fetch an event by slug (query parameter)
|
||||
curl "https://gamma-api.polymarket.com/events?slug=fed-decision-in-october"
|
||||
|
||||
# Or use the path endpoint
|
||||
curl "https://gamma-api.polymarket.com/events/slug/fed-decision-in-october"
|
||||
```
|
||||
|
||||
```bash theme={null}
|
||||
# Fetch a market by slug (query parameter)
|
||||
curl "https://gamma-api.polymarket.com/markets?slug=fed-decision-in-october"
|
||||
|
||||
# Or use the path endpoint
|
||||
curl "https://gamma-api.polymarket.com/markets/slug/fed-decision-in-october"
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## 2. Fetch by Tags
|
||||
## Fetch by Tags
|
||||
|
||||
**Use Case:** When you want to filter markets by category, sport, or topic.
|
||||
**Use case:** When you want to filter markets by category, sport, or topic.
|
||||
|
||||
Tags provide a powerful way to categorize and filter markets. You can discover available tags and then use them to filter your market requests.
|
||||
Tags provide a way to categorize and filter markets. You can discover available tags and then use them to filter your requests.
|
||||
|
||||
### Discover Available Tags
|
||||
|
||||
**General Tags:** [GET /tags](/api-reference/tags/list-tags)
|
||||
**General tags:** `GET /tags` (Gamma API)
|
||||
|
||||
**Sports Tags & Metadata:** [GET /sports](/api-reference/sports/get-sports-metadata-information)
|
||||
**Sports tags and metadata:** `GET /sports` (Gamma API)
|
||||
|
||||
The `/sports` endpoint returns comprehensive metadata for sports including tag IDs, images, resolution sources, and series information.
|
||||
The `/sports` endpoint returns metadata for sports including tag IDs, images, resolution sources, and series information.
|
||||
|
||||
### Using Tags in Market Requests
|
||||
### Filter by Tag
|
||||
|
||||
Once you have tag IDs, you can use them with the `tag_id` parameter in both markets and events endpoints.
|
||||
|
||||
**Markets with Tags:** [GET /markets](/api-reference/markets/list-markets)
|
||||
|
||||
**Events with Tags:** [GET /events](/api-reference/events/list-events)
|
||||
Once you have tag IDs, use the `tag_id` parameter in both events and markets endpoints:
|
||||
|
||||
```bash theme={null}
|
||||
curl "https://gamma-api.polymarket.com/events?tag_id=100381&limit=1&closed=false"
|
||||
|
||||
# Fetch events for a specific tag
|
||||
curl "https://gamma-api.polymarket.com/events?tag_id=100381&limit=10&active=true&closed=false"
|
||||
```
|
||||
|
||||
### Additional Tag Filtering
|
||||
@@ -81,80 +85,76 @@ You can also:
|
||||
* Use `related_tags=true` to include related tag markets
|
||||
* Exclude specific tags with `exclude_tag_id`
|
||||
|
||||
```bash theme={null}
|
||||
# Include related tags
|
||||
curl "https://gamma-api.polymarket.com/events?tag_id=100381&related_tags=true&active=true&closed=false"
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## 3. Fetch All Active Markets
|
||||
## Fetch All Active Markets
|
||||
|
||||
**Use Case:** When you need to retrieve all available active markets, typically for broader analysis or market discovery.
|
||||
**Use case:** When you need to retrieve all available active markets, typically for broader analysis or market discovery.
|
||||
|
||||
The most efficient approach is to use the `/events` endpoint and work backwards, as events contain their associated markets.
|
||||
The most efficient approach is to use the events endpoint with `active=true&closed=false`, as events contain their associated markets.
|
||||
|
||||
**Events Endpoint:** [GET /events](/api-reference/events/list-events)
|
||||
|
||||
**Markets Endpoint:** [GET /markets](/api-reference/markets/list-markets)
|
||||
```bash theme={null}
|
||||
curl "https://gamma-api.polymarket.com/events?active=true&closed=false&limit=100"
|
||||
```
|
||||
|
||||
### Key Parameters
|
||||
|
||||
* `order=id` - Order by event ID
|
||||
* `ascending=false` - Get newest events first
|
||||
* `closed=false` - Only active markets
|
||||
* `limit` - Control response size
|
||||
* `offset` - For pagination
|
||||
|
||||
### Examples
|
||||
| Parameter | Description |
|
||||
| ----------- | ---------------------------------------------------------------------------------------------------------------- |
|
||||
| `order` | Field to order by (`volume_24hr`, `volume`, `liquidity`, `start_date`, `end_date`, `competitive`, `closed_time`) |
|
||||
| `ascending` | Sort direction (`true` for ascending, `false` for descending). Default: `false` |
|
||||
| `active` | Filter by active status (`true` for live tradable events) |
|
||||
| `closed` | Filter by closed status |
|
||||
| `limit` | Results per page |
|
||||
| `offset` | Number of results to skip for pagination |
|
||||
|
||||
```bash theme={null}
|
||||
curl "https://gamma-api.polymarket.com/events?order=id&ascending=false&closed=false&limit=100"
|
||||
# Get the highest volume active events
|
||||
curl "https://gamma-api.polymarket.com/events?active=true&closed=false&order=volume_24hr&ascending=false&limit=100"
|
||||
```
|
||||
|
||||
This approach gives you all active markets ordered from newest to oldest, allowing you to systematically process all available trading opportunities.
|
||||
***
|
||||
|
||||
### Pagination
|
||||
## Pagination
|
||||
|
||||
For large datasets, use pagination with `limit` and `offset` parameters:
|
||||
|
||||
* `limit=50` - Return 50 results per page
|
||||
* `offset=0` - Start from the beginning (increment by limit for subsequent pages)
|
||||
|
||||
**Pagination Examples:**
|
||||
All list endpoints return paginated responses with `limit` and `offset` parameters:
|
||||
|
||||
```bash theme={null}
|
||||
# Page 1: First 50 results (offset=0)
|
||||
curl "https://gamma-api.polymarket.com/events?order=id&ascending=false&closed=false&limit=50&offset=0"
|
||||
```
|
||||
# Page 1: First 50 results
|
||||
curl "https://gamma-api.polymarket.com/events?active=true&closed=false&limit=50&offset=0"
|
||||
|
||||
```bash theme={null}
|
||||
# Page 2: Next 50 results (offset=50)
|
||||
curl "https://gamma-api.polymarket.com/events?order=id&ascending=false&closed=false&limit=50&offset=50"
|
||||
```
|
||||
# Page 2: Next 50 results
|
||||
curl "https://gamma-api.polymarket.com/events?active=true&closed=false&limit=50&offset=50"
|
||||
|
||||
```bash theme={null}
|
||||
# Page 3: Next 50 results (offset=100)
|
||||
curl "https://gamma-api.polymarket.com/events?order=id&ascending=false&closed=false&limit=50&offset=100"
|
||||
```
|
||||
|
||||
```bash theme={null}
|
||||
# Paginating through markets with tag filtering
|
||||
curl "https://gamma-api.polymarket.com/markets?tag_id=100381&closed=false&limit=25&offset=0"
|
||||
```
|
||||
|
||||
```bash theme={null}
|
||||
# Next page of markets with tag filtering
|
||||
curl "https://gamma-api.polymarket.com/markets?tag_id=100381&closed=false&limit=25&offset=25"
|
||||
# Page 3: Next 50 results
|
||||
curl "https://gamma-api.polymarket.com/events?active=true&closed=false&limit=50&offset=100"
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **For Individual Markets:** Always use the slug method for best performance
|
||||
2. **For Category Browsing:** Use tag filtering to reduce API calls
|
||||
3. **For Complete Market Discovery:** Use the events endpoint with pagination
|
||||
4. **Always Include `closed=false`:** Unless you specifically need historical data
|
||||
5. **Implement Rate Limiting:** Respect API limits for production applications
|
||||
1. **For individual markets:** Use the slug method for direct lookups
|
||||
2. **For category browsing:** Use tag filtering to reduce API calls
|
||||
3. **For complete market discovery:** Use the events endpoint with pagination
|
||||
4. **Always include `active=true&closed=false`** unless you specifically need historical data
|
||||
5. **Use the events endpoint** and work backwards — events contain their associated markets, reducing the number of API calls needed
|
||||
|
||||
## Related Endpoints
|
||||
***
|
||||
|
||||
* [Get Markets](/developers/gamma-markets-api/get-markets) - Full markets endpoint documentation
|
||||
* [Get Events](/developers/gamma-markets-api/get-events) - Full events endpoint documentation
|
||||
* [Search Markets](/developers/gamma-markets-api/get-public-search) - Search functionality
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="API Reference" icon="code" href="/api-reference/introduction">
|
||||
Full endpoint documentation with parameters and response schemas.
|
||||
</Card>
|
||||
|
||||
<Card title="Subgraph" icon="share-nodes" href="/market-data/subgraph">
|
||||
Query onchain data directly from the Polymarket subgraph.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -2,26 +2,107 @@
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Gamma Structure
|
||||
# Markets & Events
|
||||
|
||||
Gamma provides some organizational models. These include events, and markets. The most fundamental element is always markets and the other models simply provide additional organization.
|
||||
> Understanding the fundamental building blocks of Polymarket
|
||||
|
||||
# Detail
|
||||
Every prediction on Polymarket is structured around two core concepts: **markets** and **events**. Understanding how they relate is essential for building on the platform.
|
||||
|
||||
1. **Market**
|
||||
1. Contains data related to a market that is traded on. Maps onto a pair of clob token ids, a market address, a question id and a condition id
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event-market.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=4c62bd08a405868307cdd6799b368ca5" alt="" className="dark:hidden" data-og-width="1540" width="1540" data-og-height="952" height="952" data-path="images/core-concepts/event-market.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event-market.png?w=280&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=0bd6fa8d9505b0f2fa4626c7d596b0e8 280w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event-market.png?w=560&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=f6acefe7559f5e48d1903fb772754aeb 560w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event-market.png?w=840&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=603c382f66e84f9020d45cd43ac59ea4 840w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event-market.png?w=1100&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=eaed4a9b88ff99c795bb27654a1914cd 1100w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event-market.png?w=1650&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=020326eff37833ae1111575e85ecf898 1650w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event-market.png?w=2500&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=57ce32b2abd1a2f7193a0c9bad064fbc 2500w" />
|
||||
|
||||
2. **Event**
|
||||
1. Contains a set of markets
|
||||
2. Variants:
|
||||
1. Event with 1 market (i.e., resulting in an SMP)
|
||||
2. Event with 2 or more markets (i.e., resulting in an GMP)
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event-market.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=2eb5c9b0f8a2afe52bc2e717b7b796a2" alt="" className="hidden dark:block" data-og-width="1540" width="1540" data-og-height="952" height="952" data-path="images/dark/core-concepts/event-market.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event-market.png?w=280&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=c4da01c8fec2e6cfe7f2d4934200ebf7 280w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event-market.png?w=560&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=e52eafe9dca3370f2cf9f48aa7a587fa 560w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event-market.png?w=840&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=420de664532386a57e674c37e2475f45 840w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event-market.png?w=1100&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=e7aeeb9c591df58d3de1d3d3ee9b6aa5 1100w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event-market.png?w=1650&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=b68ab7f2f68b3ee6c1670edab68dddd6 1650w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event-market.png?w=2500&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=89ae2017bf3ee1eec57ebd4ac4b5cddc 2500w" />
|
||||
</Frame>
|
||||
|
||||
# Example
|
||||
## Markets
|
||||
|
||||
* **\[Event]** Where will Barron Trump attend College?
|
||||
* **\[Market]** Will Barron attend Georgetown?
|
||||
* **\[Market]** Will Barron attend NYU?
|
||||
* **\[Market]** Will Barron attend UPenn?
|
||||
* **\[Market]** Will Barron attend Harvard?
|
||||
* **\[Market]** Will Barron attend another college?
|
||||
A **market** is the fundamental tradable unit on Polymarket. Each market represents a single binary question with Yes/No outcomes.
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=0c9a264aec9a22ce5a20c4cc7980806d" alt="" className="dark:hidden" data-og-width="1540" width="1540" data-og-height="952" height="952" data-path="images/core-concepts/event.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event.png?w=280&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=72a07b6b9d83367b9aa829a60c07f2b3 280w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event.png?w=560&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=a222505efdc485a3b2410055394109cd 560w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event.png?w=840&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=1afd89af327cef04f03a0c085a4a0ef5 840w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event.png?w=1100&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=a419c0d09ca0cbb7f870372157c56727 1100w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event.png?w=1650&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=19797452df63f42cf2d84e709483a4a2 1650w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event.png?w=2500&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=4643344994e4717bfdc94bad606eda7f 2500w" />
|
||||
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=912e41bebfe8c1a43ef53b89685ca3d2" alt="" className="hidden dark:block" data-og-width="1540" width="1540" data-og-height="952" height="952" data-path="images/dark/core-concepts/event.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event.png?w=280&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=541e0c044f32f667c9c59e31f1572167 280w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event.png?w=560&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=16e79044e1f4cb99e3c28335308ea821 560w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event.png?w=840&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=71d440db449638eec0f3b8a5d80bef13 840w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event.png?w=1100&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=25f781834c41ecd4d835e0c209bceb2e 1100w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event.png?w=1650&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=1a2120728cf262e68d993a1db44371b1 1650w, https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event.png?w=2500&fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=9ecb8ab37d7fc4460fa07c892ab1978a 2500w" />
|
||||
</Frame>
|
||||
|
||||
Every market has:
|
||||
|
||||
| Identifier | Description |
|
||||
| ---------------- | ------------------------------------------------------------------------ |
|
||||
| **Condition ID** | Unique identifier for the market's condition in the CTF contracts |
|
||||
| **Question ID** | Hash of the market question used for resolution |
|
||||
| **Token IDs** | ERC1155 token IDs used for trading on the CLOB — one for Yes, one for No |
|
||||
|
||||
<Note>
|
||||
Markets can only be traded via the CLOB if `enableOrderBook` is `true`. Some
|
||||
markets may exist onchain but not be available for order book trading.
|
||||
</Note>
|
||||
|
||||
### Market Example
|
||||
|
||||
A simple market might be:
|
||||
|
||||
> **"Will Bitcoin reach \$150,000 by December 2026?"**
|
||||
|
||||
This creates two outcome tokens:
|
||||
|
||||
* **Yes token** - Redeemable for `$1` if Bitcoin reaches `$150k`
|
||||
* **No token** - Redeemable for `$1` if Bitcoin doesn't reach `$100k`
|
||||
|
||||
## Events
|
||||
|
||||
An **event** is a container that groups one or more related markets together. Events provide organizational structure and enable multi-outcome predictions.
|
||||
|
||||
### Single-Market Events
|
||||
|
||||
When an event contains just one market, it creates a simple market pair. The event and market are essentially equivalent.
|
||||
|
||||
```
|
||||
Event: Will Bitcoin reach $100,000 by December 2024?
|
||||
└── Market: Will Bitcoin reach $100,000 by December 2024? (Yes/No)
|
||||
```
|
||||
|
||||
### Multi-Market Events
|
||||
|
||||
When an event contains two or more markets, it creates a grouped market pair. This enables mutually exclusive multi-outcome predictions.
|
||||
|
||||
```
|
||||
Event: Who will win the 2024 Presidential Election?
|
||||
├── Market: Donald Trump? (Yes/No)
|
||||
├── Market: Joe Biden? (Yes/No)
|
||||
├── Market: Kamala Harris? (Yes/No)
|
||||
└── Market: Other? (Yes/No)
|
||||
```
|
||||
|
||||
## Identifying Markets
|
||||
|
||||
Every market and event has a unique **slug** that appears in the Polymarket URL:
|
||||
|
||||
```
|
||||
https://polymarket.com/event/fed-decision-in-october
|
||||
└── slug: fed-decision-in-october
|
||||
```
|
||||
|
||||
You can use slugs to fetch specific markets or events from the API:
|
||||
|
||||
```bash theme={null}
|
||||
# Fetch event by slug
|
||||
curl "https://gamma-api.polymarket.com/events?slug=fed-decision-in-october"
|
||||
```
|
||||
|
||||
## Sports Markets
|
||||
|
||||
Specifically for sports markets, outstanding limit orders are **automatically cancelled** once the game begins, clearing the order book at the official start time. However, game start times can shift — if a game starts earlier than scheduled, orders may not be cleared in time. Always monitor your orders closely around game start times.
|
||||
|
||||
***
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Prices & Orderbook" icon="chart-line" href="/concepts/prices-orderbook">
|
||||
Learn how prices are determined and how the order book works.
|
||||
</Card>
|
||||
|
||||
<Card title="Fetching Market Data" icon="code" href="/market-data/overview">
|
||||
Start querying markets and events from the API.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -2,10 +2,110 @@
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# null
|
||||
# Overview
|
||||
|
||||
All market data necessary for market resolution is available on-chain (ie ancillaryData in UMA 00 request), but Polymarket also provides a hosted service, Gamma, that indexes this data and provides additional market metadata (ie categorization, indexed volume, etc). This service is made available through a REST API. For public users, this resource read only and can be used to fetch useful information about markets for things like non-profit research projects, alternative trading interfaces, automated trading systems etc.
|
||||
> Fetch market data with no authentication required
|
||||
|
||||
# Endpoint
|
||||
All market data is available through public REST endpoints. No API key, no authentication, no wallet required.
|
||||
|
||||
[https://gamma-api.polymarket.com](https://gamma-api.polymarket.com)
|
||||
```bash theme={null}
|
||||
curl "https://gamma-api.polymarket.com/events?limit=5"
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Data Model
|
||||
|
||||
Polymarket structures data using two organizational models. The most fundamental element is always markets—events simply provide additional organization.
|
||||
|
||||
<Steps>
|
||||
<Step title="Event">
|
||||
A top-level object representing a question (e.g., "Who will win the 2024
|
||||
Presidential Election?"). Contains one or more markets.
|
||||
</Step>
|
||||
|
||||
<Step title="Market">
|
||||
A specific tradable binary outcome within an event. Maps to a pair of CLOB
|
||||
token IDs, a market address, a question ID, and a condition ID.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
### Single-Market Events vs Multi-Market Events
|
||||
|
||||
| Type | Example |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------- |
|
||||
| Single-market event | "Will Bitcoin reach \$100k?" → 1 market (Yes/No) |
|
||||
| Multi-market event | "Where will Barron Trump attend College?" → Markets for Georgetown, NYU, UPenn, Harvard, Other |
|
||||
|
||||
### Outcomes and Prices
|
||||
|
||||
Each market has `outcomes` and `outcomePrices` arrays that map 1:1. Prices represent implied probabilities:
|
||||
|
||||
```json theme={null}
|
||||
{
|
||||
"outcomes": "[\"Yes\", \"No\"]",
|
||||
"outcomePrices": "[\"0.20\", \"0.80\"]"
|
||||
}
|
||||
// Index 0: "Yes" → 0.20 (20% probability)
|
||||
// Index 1: "No" → 0.80 (80% probability)
|
||||
```
|
||||
|
||||
<Info>Markets can be traded via the CLOB if `enableOrderBook` is `true`.</Info>
|
||||
|
||||
***
|
||||
|
||||
## Available Data
|
||||
|
||||
Endpoints are split across three APIs. See the [API Reference](/api-reference/introduction) for full endpoint documentation with parameters and response schemas.
|
||||
|
||||
### Gamma API (`gamma-api.polymarket.com`) — Events, Markets & Discovery
|
||||
|
||||
| Endpoint | Description |
|
||||
| -------------------- | ------------------------------------------- |
|
||||
| `GET /events` | List events with filtering and pagination |
|
||||
| `GET /events/{id}` | Get a single event by ID |
|
||||
| `GET /markets` | List markets with filtering and pagination |
|
||||
| `GET /markets/{id}` | Get a single market by ID |
|
||||
| `GET /public-search` | Search across events, markets, and profiles |
|
||||
| `GET /tags` | Ranked tags/categories |
|
||||
| `GET /series` | Series (grouped events) |
|
||||
| `GET /sports` | Sports metadata |
|
||||
| `GET /teams` | Teams |
|
||||
|
||||
### CLOB API (`clob.polymarket.com`) — Prices & Orderbooks
|
||||
|
||||
| Endpoint | Description |
|
||||
| --------------------- | --------------------------------- |
|
||||
| `GET /price` | Price for a single token |
|
||||
| `GET /prices` | Prices for multiple tokens |
|
||||
| `GET /book` | Order book for a token |
|
||||
| `POST /books` | Order books for multiple tokens |
|
||||
| `GET /prices-history` | Historical price data for a token |
|
||||
| `GET /midpoint` | Midpoint price for a token |
|
||||
| `GET /spread` | Spread for a token |
|
||||
|
||||
### Data API (`data-api.polymarket.com`) — Positions, Trades & Analytics
|
||||
|
||||
| Endpoint | Description |
|
||||
| -------------------------------------- | ---------------------------- |
|
||||
| `GET /positions?user={address}` | Current positions for a user |
|
||||
| `GET /closed-positions?user={address}` | Closed positions for a user |
|
||||
| `GET /activity?user={address}` | Onchain activity for a user |
|
||||
| `GET /value?user={address}` | Total position value |
|
||||
| `GET /oi` | Open interest for a market |
|
||||
| `GET /holders` | Top holders of a market |
|
||||
| `GET /trades` | Trade history |
|
||||
|
||||
***
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Fetching Markets" icon="magnifying-glass" href="/market-data/fetching-markets">
|
||||
Three strategies for discovering and querying markets.
|
||||
</Card>
|
||||
|
||||
<Card title="API Reference" icon="code" href="/api-reference/introduction">
|
||||
Full endpoint documentation with parameters and response schemas.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
Reference in New Issue
Block a user