TypeScript client
Official RTDS TypeScript client (
real-time-data-client).Endpoint
gamma_auth with your wallet address.
Subscribing
Send a JSON message to subscribe to data streams:"action": "unsubscribe".
Subscriptions can be added, removed, and modified without disconnecting. Send PING messages every 5 seconds to maintain the connection.
Only the subscription types documented below are supported.
Message Structure
All messages follow this structure:| Field | Type | Description |
|---|---|---|
topic | string | The subscription topic (e.g., crypto_prices, comments) |
type | string | The message type/event (e.g., update, reaction_created) |
timestamp | number | Unix timestamp in milliseconds when the message was sent |
payload | object | Event-specific data object |
Crypto Prices
Real-time cryptocurrency price data from two sources: Binance and Chainlink. No authentication required.Binance Source
Subscribe to all symbols:solusdt, btcusdt).
Solana price update:
Chainlink Source
Subscribe to all symbols:eth/usd, btc/usd).
Ethereum price update:
Price Payload Fields
| Field | Type | Description |
|---|---|---|
symbol | string | Trading pair symbol. Binance: lowercase concatenated (e.g., solusdt, btcusdt). Chainlink: slash-separated (e.g., eth/usd, btc/usd) |
timestamp | number | When the price was recorded, in Unix milliseconds |
value | number | Current price value in the quote currency |
Supported Symbols
Binance Source — lowercase concatenated format:btcusdt— Bitcoin to USDTethusdt— Ethereum to USDTsolusdt— Solana to USDTxrpusdt— XRP to USDT
btc/usd— Bitcoin to USDeth/usd— Ethereum to USDsol/usd— Solana to USDxrp/usd— XRP to USD
Comments
Real-time comment events on the Polymarket platform, including new comments, replies, reactions, and removals. May require Gamma authentication for user-specific data.Subscribe
Message Types
| Type | Description |
|---|---|
comment_created | A user creates a new comment or reply |
comment_removed | A comment is removed or deleted |
reaction_created | A user adds a reaction to a comment |
reaction_removed | A reaction is removed from a comment |
comment_created
Emitted when a user posts a new comment or replies to an existing one.parentCommentID references the parent:
Comment Payload Fields
| Field | Type | Description |
|---|---|---|
body | string | The text content of the comment |
createdAt | string | ISO 8601 timestamp when the comment was created |
id | string | Unique identifier for this comment |
parentCommentID | string | ID of the parent comment if this is a reply (null for top-level comments) |
parentEntityID | number | ID of the parent entity (event, market, etc.) |
parentEntityType | string | Type of parent entity (Event, Market) |
profile | object | Profile information of the comment author |
reactionCount | number | Current number of reactions on this comment |
replyAddress | string | Polygon address for replies (may differ from userAddress) |
reportCount | number | Current number of reports on this comment |
userAddress | string | Polygon address of the comment author |
Profile Object Fields
| Field | Type | Description |
|---|---|---|
baseAddress | string | User profile address |
displayUsernamePublic | boolean | Whether the username is displayed publicly |
name | string | User’s display name |
proxyWallet | string | Proxy wallet address used for transactions |
pseudonym | string | Generated pseudonym for the user |
Comment Hierarchy
Comments support nested threading:- Top-level comments:
parentCommentIDis null or empty - Reply comments:
parentCommentIDcontains the ID of the parent comment - All comments are associated with a
parentEntityIDandparentEntityType(EventorMarket)
Troubleshooting
Connection drops unexpectedly
Connection drops unexpectedly
Send
PING messages every 5 seconds to keep the connection alive. Connection errors will trigger automatic reconnection attempts.Not receiving messages after subscribing
Not receiving messages after subscribing
Verify your subscription message is valid JSON with the correct
action, topic, and type fields. Invalid subscription messages may result in connection closure.Authentication failures
Authentication failures
If subscribing to user-specific streams, ensure your
gamma_auth object includes a valid wallet address. Authentication failures will prevent subscription to protected topics.