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,15 +2,40 @@
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Message Format
|
||||
# Sports WebSocket
|
||||
|
||||
> Structure of sports result update messages
|
||||
> Live sports scores and game state
|
||||
|
||||
Once connected to the Sports WebSocket, clients receive JSON messages whenever a sports event updates. Messages are broadcast to all connected clients automatically.
|
||||
The Sports WebSocket provides real-time sports results updates, including scores, periods, and game status. No authentication required.
|
||||
|
||||
***
|
||||
## Endpoint
|
||||
|
||||
## sport\_result Message
|
||||
```
|
||||
wss://sports-api.polymarket.com/ws
|
||||
```
|
||||
|
||||
No subscription message required — connect and start receiving data for all active sports events.
|
||||
|
||||
## Heartbeat
|
||||
|
||||
The server sends `ping` every 5 seconds. Respond with `pong` within 10 seconds or the connection will close.
|
||||
|
||||
```javascript theme={null}
|
||||
ws.onmessage = (event) => {
|
||||
if (event.data === "ping") {
|
||||
ws.send("pong");
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle JSON messages...
|
||||
};
|
||||
```
|
||||
|
||||
## Message Type
|
||||
|
||||
Each message is a JSON object with game state fields.
|
||||
|
||||
### sport\_result
|
||||
|
||||
Emitted when:
|
||||
|
||||
@@ -20,68 +45,13 @@ Emitted when:
|
||||
* A match ends
|
||||
* Possession changes (NFL and CFB only)
|
||||
|
||||
### Structure
|
||||
|
||||
<ParamField path="gameId" type="number">
|
||||
Unique identifier for the game
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="leagueAbbreviation" type="string">
|
||||
League identifier (e.g., `"nfl"`, `"nba"`, `"cs2"`)
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="homeTeam" type="string">
|
||||
Home team name or abbreviation
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="awayTeam" type="string">
|
||||
Away team name or abbreviation
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="status" type="string">
|
||||
Game status (e.g., `"InProgress"`, `"finished"`)
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="live" type="boolean">
|
||||
`true` if the match is currently in progress
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="ended" type="boolean">
|
||||
`true` if the match has concluded
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="score" type="string">
|
||||
Current score (format varies by sport)
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="period" type="string">
|
||||
Current period (e.g., `"Q4"`, `"2H"`, `"2/3"`)
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="elapsed" type="string">
|
||||
Time elapsed in current period (e.g., `"05:09"`)
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="finishedTimestamp" type="string">
|
||||
Timestamp when the match ended (only present when `ended: true`)
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="turn" type="string">
|
||||
Team abbreviation with possession (NFL/CFB only)
|
||||
</ParamField>
|
||||
|
||||
<Note>
|
||||
The `turn` field is only present for NFL and CFB games and indicates which team currently has the ball.
|
||||
</Note>
|
||||
|
||||
### Example Messages
|
||||
|
||||
**NFL (in progress):**
|
||||
|
||||
```json theme={null}
|
||||
{
|
||||
"gameId": 19439,
|
||||
"leagueAbbreviation": "nfl",
|
||||
"slug": "nfl-lac-buf-2025-01-26",
|
||||
"homeTeam": "LAC",
|
||||
"awayTeam": "BUF",
|
||||
"status": "InProgress",
|
||||
@@ -94,39 +64,27 @@ Emitted when:
|
||||
}
|
||||
```
|
||||
|
||||
**Esports - CS2 (finished):**
|
||||
**Esports — CS2 (finished):**
|
||||
|
||||
```json theme={null}
|
||||
{
|
||||
"gameId": 1317359,
|
||||
"leagueAbbreviation": "cs2",
|
||||
"slug": "cs2-arcred-the-glecs-2025-07-20",
|
||||
"homeTeam": "ARCRED",
|
||||
"awayTeam": "The glecs",
|
||||
"status": "finished",
|
||||
"score": "000-000|2-0|Bo3",
|
||||
"period": "2/3",
|
||||
"live": false,
|
||||
"ended": true
|
||||
"ended": true,
|
||||
"finished_timestamp": "2025-07-20T18:30:00.000Z"
|
||||
}
|
||||
```
|
||||
|
||||
***
|
||||
The `finished_timestamp` field is an ISO 8601 timestamp only present when `ended: true`.
|
||||
|
||||
## Slug Format
|
||||
|
||||
The `slug` field follows a consistent naming convention:
|
||||
|
||||
```
|
||||
{league}-{team1}-{team2}-{date}
|
||||
```
|
||||
|
||||
**Examples:**
|
||||
|
||||
* `nfl-buf-kc-2025-01-26` — NFL: Buffalo Bills vs Kansas City Chiefs
|
||||
* `nba-lal-bos-2025-02-15` — NBA: LA Lakers vs Boston Celtics
|
||||
* `mlb-nyy-bos-2025-04-01` — MLB: NY Yankees vs Boston Red Sox
|
||||
|
||||
***
|
||||
The `slug` field follows the format `{league}-{team1}-{team2}-{date}` (e.g., `nfl-buf-kc-2025-01-26`).
|
||||
|
||||
## Period Values
|
||||
|
||||
@@ -139,25 +97,119 @@ The `slug` field follows a consistent naming convention:
|
||||
| `FT` | Full time (match ended in regulation) |
|
||||
| `FT OT` | Full time with overtime |
|
||||
| `FT NR` | Full time, no result (draw or canceled) |
|
||||
| `End 1`, `End 2`, etc. | End of inning (MLB) |
|
||||
| `End 1`, `End 2`, ... | End of inning (MLB) |
|
||||
| `1/3`, `2/3`, `3/3` | Map number in Bo3 series (Esports) |
|
||||
| `1/5`, `2/5`, etc. | Map number in Bo5 series (Esports) |
|
||||
| `1/5`, `2/5`, ... | Map number in Bo5 series (Esports) |
|
||||
|
||||
***
|
||||
## Game Status Values
|
||||
|
||||
## Handling Updates
|
||||
Game status values vary by sport:
|
||||
|
||||
When processing messages, use the `gameId` field as the unique identifier to update your local state:
|
||||
### NFL
|
||||
|
||||
```javascript theme={null}
|
||||
// Update or insert based on gameId
|
||||
setSportsData(prev => {
|
||||
const existing = prev.find(item => item.gameId === data.gameId);
|
||||
if (existing) {
|
||||
return prev.map(item =>
|
||||
item.gameId === data.gameId ? data : item
|
||||
);
|
||||
}
|
||||
return [...prev, data];
|
||||
});
|
||||
```
|
||||
| Status | Description |
|
||||
| -------------- | ---------------------------- |
|
||||
| `Scheduled` | Game not yet started |
|
||||
| `InProgress` | Game currently playing |
|
||||
| `Final` | Game completed in regulation |
|
||||
| `F/OT` | Final after overtime |
|
||||
| `Suspended` | Game suspended |
|
||||
| `Postponed` | Game postponed |
|
||||
| `Delayed` | Game delayed |
|
||||
| `Canceled` | Game canceled |
|
||||
| `Forfeit` | Game forfeited |
|
||||
| `NotNecessary` | Scheduled, but not needed |
|
||||
|
||||
### NHL
|
||||
|
||||
| Status | Description |
|
||||
| -------------- | ---------------------------- |
|
||||
| `Scheduled` | Game not yet started |
|
||||
| `InProgress` | Game currently playing |
|
||||
| `Final` | Game completed in regulation |
|
||||
| `F/OT` | Final after overtime |
|
||||
| `F/SO` | Final after shootout |
|
||||
| `Suspended` | Game suspended |
|
||||
| `Postponed` | Game postponed |
|
||||
| `Delayed` | Game delayed |
|
||||
| `Canceled` | Game canceled |
|
||||
| `Forfeit` | Game forfeited |
|
||||
| `NotNecessary` | Scheduled, but not needed |
|
||||
|
||||
### MLB
|
||||
|
||||
| Status | Description |
|
||||
| -------------- | ------------------------- |
|
||||
| `Scheduled` | Game not yet started |
|
||||
| `InProgress` | Game currently playing |
|
||||
| `Final` | Game completed |
|
||||
| `Suspended` | Game suspended |
|
||||
| `Delayed` | Game delayed |
|
||||
| `Postponed` | Game postponed |
|
||||
| `Canceled` | Game canceled |
|
||||
| `Forfeit` | Game forfeited |
|
||||
| `NotNecessary` | Scheduled, but not needed |
|
||||
|
||||
### NBA / CBB
|
||||
|
||||
| Status | Description |
|
||||
| -------------- | ------------------------- |
|
||||
| `Scheduled` | Game not yet started |
|
||||
| `InProgress` | Game currently playing |
|
||||
| `Final` | Game completed |
|
||||
| `F/OT` | Final after overtime |
|
||||
| `Suspended` | Game suspended |
|
||||
| `Postponed` | Game postponed |
|
||||
| `Delayed` | Game delayed |
|
||||
| `Canceled` | Game canceled |
|
||||
| `Forfeit` | Game forfeited |
|
||||
| `NotNecessary` | Scheduled, but not needed |
|
||||
|
||||
### CFB
|
||||
|
||||
| Status | Description |
|
||||
| ------------ | ---------------------- |
|
||||
| `Scheduled` | Game not yet started |
|
||||
| `InProgress` | Game currently playing |
|
||||
| `Final` | Game completed |
|
||||
| `F/OT` | Final after overtime |
|
||||
| `Suspended` | Game suspended |
|
||||
| `Postponed` | Game postponed |
|
||||
| `Delayed` | Game delayed |
|
||||
| `Canceled` | Game canceled |
|
||||
| `Forfeit` | Game forfeited |
|
||||
|
||||
### Soccer
|
||||
|
||||
| Status | Description |
|
||||
| ----------------- | ------------------------------------ |
|
||||
| `Scheduled` | Game not yet started |
|
||||
| `InProgress` | Game currently playing |
|
||||
| `Break` | Halftime or other break |
|
||||
| `Suspended` | Game suspended |
|
||||
| `PenaltyShootout` | Penalty shootout in progress |
|
||||
| `Final` | Game completed |
|
||||
| `Awarded` | Result awarded due to ruling/forfeit |
|
||||
| `Postponed` | Game postponed |
|
||||
| `Canceled` | Game canceled |
|
||||
|
||||
### Esports
|
||||
|
||||
| Status | Description |
|
||||
| ------------- | ----------------------- |
|
||||
| `not_started` | Match not yet started |
|
||||
| `running` | Match currently playing |
|
||||
| `finished` | Match completed |
|
||||
| `postponed` | Match postponed |
|
||||
| `canceled` | Match canceled |
|
||||
|
||||
### Tennis
|
||||
|
||||
| Status | Description |
|
||||
| ------------ | ----------------------- |
|
||||
| `scheduled` | Match not yet started |
|
||||
| `inprogress` | Match currently playing |
|
||||
| `suspended` | Match suspended |
|
||||
| `finished` | Match completed |
|
||||
| `postponed` | Match postponed |
|
||||
| `cancelled` | Match canceled |
|
||||
|
||||
Reference in New Issue
Block a user