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, equity_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
Equity Prices
Real-time price data for stocks, ETFs, forex pairs, precious metals, and commodities sourced from Pyth Network. No authentication required. All asset classes stream through a singleequity_prices topic. When you subscribe with a symbol filter, the server sends a historical snapshot (last 2 minutes of data), then continues streaming live updates.
Subscribe
Subscribe to a specific symbol with a JSON filter:type: "*" to receive all message types (live updates and snapshots):
symbol field in payloads is always returned lowercase.
Live Price Update
Apple stock update:Historical Snapshot
On subscribe, the server delivers a backfill of the last 2 minutes of price data. Use thetype field to distinguish: "subscribe" for the initial snapshot vs "update" for live ticks.
Equity Price Payload Fields
| Field | Type | Description |
|---|---|---|
symbol | string | Lowercase symbol identifier (e.g., aapl, eurusd, xauusd) |
value | number | Spot price as a float |
full_accuracy_value | string | Full-precision price as a string |
timestamp | number | Price measurement timestamp in Unix milliseconds |
received_at | number | When the system received the price, in Unix milliseconds. Only present when non-zero. |
is_carried_forward | boolean | true when the market session is closed and the value is the last known price. Only present when true. |
Supported Symbols
Stocks:| Symbol | Name |
|---|---|
AAPL | Apple |
TSLA | Tesla |
MSFT | Microsoft |
GOOGL | Alphabet |
AMZN | Amazon |
META | Meta Platforms |
NVDA | NVIDIA |
NFLX | Netflix |
PLTR | Palantir |
OPEN | Opendoor |
RKLB | Rocket Lab |
ABNB | Airbnb |
COIN | Coinbase |
HOOD | Robinhood |
| Symbol | Name |
|---|---|
QQQ | Invesco QQQ ETF |
SPY | S&P 500 ETF |
EWY | iShares MSCI South Korea ETF |
VXX | Barclays iPath Series B S&P 500 VIX |
| Symbol | Pair |
|---|---|
EURUSD | Euro / US Dollar |
GBPUSD | British Pound / US Dollar |
USDCAD | US Dollar / Canadian Dollar |
USDJPY | US Dollar / Japanese Yen |
USDKRW | US Dollar / South Korean Won |
| Symbol | Name |
|---|---|
XAUUSD | Gold |
XAGUSD | Silver |
| Symbol | Name |
|---|---|
WTI | Crude Oil (WTI) |
CC | Cocoa |
NGD | Natural Gas |
Market Hours
When a market session is closed, the stream continues with the last known price andis_carried_forward: true. This lets you distinguish stale prices from live ticks. Update frequency is sub-second (up to 5 per second per feed) during market hours.
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.