TypeScript SDK — WebSocket Reference
Every WebSocket stream and method, with the exact payload field names. WebSocket messages use a compact wire format with single-letter field names — this page maps each letter to its meaning so you never need to inspect the source.
Public streams and controls are on client.websocket.public; authenticated
streams and controls are on client.websocket.private in the server entry
point. These are separate WebSocket connections: public frames never enter the
authenticated session, and private operations are not available through the
browser entry point. See the WebSocket guide
for lifecycle, reconnection, and usage patterns.
Public streams
No authentication required. Each returns a WebSocketStream<T> you subscribe to with .on("message", …).
| Method | Payload type | Description |
|---|---|---|
public.trades(symbol, options?) | Trade | Real-time trade prints |
public.bookTicker(symbol, options?) | BookTicker | Best bid/ask updates |
public.depthUpdates(symbol, options?) | DepthUpdate | Incremental order book diffs |
public.depth(symbol, options) | OrderBookSnapshot | Periodic top-N depth snapshots (options.levels: 5, 10, or 20) |
public.contractStatus(options?) | ContractStatus | Prediction market contract status changes |
public.rfqs(options?) | RfqPublicEvent | Public request-for-quote events (production beta; no authentication required) |
Authenticated streams
Require an auth strategy and the server entry point (browser WebSocket cannot set upgrade headers).
| Method | Payload type | Description |
|---|---|---|
private.orders(options) | OrderUpdate | Order lifecycle updates (options.scope: "account" or "session") |
private.balances(options?) | BalanceUpdate | Balance changes (options.intervalMs: 0 or 1000) |
private.positions(options?) | PositionReport | Position updates (options.intervalMs: 0 or 1000); terminal prediction-market settlement rows are available on the realtime stream |
private.rfqDeliveries(options) | RfqPrivateDelivery | Private RFQ delivery confirmations (options.scope) (production beta; quoting requires an eligible account) |
intervalMs: 1000 selects positions@account@1s, a periodic snapshot of open
positions. It does not include terminal settlement rows.
Request/response methods
These send a request and resolve with a response, rather than streaming.
| Method | Returns | Description |
|---|---|---|
private.placeOrder(params, options?) | OrderActionResponse | Place an order over WebSocket |
private.cancelOrder(params, options?) | OrderActionResponse | Cancel a single order |
private.cancelAllOrders(options) | OrderActionResponse | Cancel all orders (options.confirm must be true) |
private.cancelSessionOrders(options) | OrderActionResponse | Cancel session orders (options.confirm must be true) |
public.ping(options?) | GenericSuccessResponse | Round-trip liveness check on the public connection |
public.time(options?) | GenericSuccessResponse | Server time from the public connection |
public.conninfo(options?) | WebSocketJsonObject | Connection info for the public connection |
public.listSubscriptions(options?) | ListSubscriptionsResponse | Subscriptions on the public connection |
public.depthSnapshot(symbol, options?) | DepthResponse | One-shot depth snapshot |
private.conninfo(options?) | WebSocketJsonObject | Connection info for the authenticated private connection |
private.listSubscriptions(options?) | ListSubscriptionsResponse | Subscriptions on the authenticated private connection |
RFQ quote methods
Availability: RFQ streams and methods are available in production for beta testing. Quoting requires an eligible account with the required capabilities.
Accessed via client.websocket.private.rfq on server clients:
| Method | Params | Returns |
|---|---|---|
private.rfq.submitQuote(params, options?) | RfqSubmitQuoteParams | RfqSubmitQuoteResponse |
private.rfq.withdrawQuote(params, options?) | RfqWithdrawQuoteParams | RfqWithdrawQuoteResponse |
private.rfq.confirmQuote(params, options?) | RfqConfirmQuoteParams | RfqConfirmQuoteResponse |
Wire format
WebSocket payloads use single-letter field names. These are the exact fields on each type. Prices and quantities are decimal strings (never floats — see Data Types); timestamps and IDs may be bigint.
Trade
Code
| Field | Type | Meaning |
|---|---|---|
E | number | bigint | Event time (nanoseconds) |
s | string | Symbol |
t | number | bigint | Trade ID |
p | string | Price |
q | string | Quantity |
m | boolean | Whether the buyer is the maker |
BookTicker
| Field | Type | Meaning |
|---|---|---|
u | number | bigint | Update ID |
E | number | bigint | Event time (nanoseconds) |
s | string | Symbol |
b | string | Best bid price |
B | string | Best bid quantity |
a | string | Best ask price |
A | string | Best ask quantity |
c | string? | Last trade price (present once the book has traded) |
C | string? | Last trade quantity |
DepthUpdate
| Field | Type | Meaning |
|---|---|---|
e | "depthUpdate" | Event type discriminator |
E | number | bigint | Event time (nanoseconds) |
s | string | Symbol |
U | number | bigint | First update ID in this diff |
u | number | bigint | Last update ID in this diff |
b | string[][] | Bid changes as [price, quantity] pairs |
a | string[][] | Ask changes as [price, quantity] pairs |
A quantity of "0" means the level was removed. See Order Book Reconstruction for how the SDK applies these.
OrderUpdate
Code
| Field | Type | Meaning |
|---|---|---|
e | "orderUpdate" | Event type discriminator |
E | number | bigint | Event time (nanoseconds) |
s | string | Symbol |
i | number | bigint | Order ID |
c | string? | Client order ID. For RFQ maker fills, this is the clientId supplied to rfq.submit_quote, or Gemini's deterministic RFQ client order ID when omitted. |
S | "BUY" | "SELL" (optional) | Side |
o | "LIMIT" | "MARKET" | "STOP_LIMIT" | "STOP_MARKET" (optional) | Order type |
X | "NEW" | "OPEN" | "FILLED" | "PARTIALLY_FILLED" | "CANCELED" | "REJECTED" | "MODIFIED" | Order status |
O | "YES" | "NO" (optional) | Prediction outcome |
p | string? | Order price |
P | string? | Stop price |
q | string? | Order quantity |
z | string? | Remaining quantity |
Z | string? | Executed quantity (last fill for FILLED/PARTIALLY_FILLED; cumulative for CANCELED and other terminal events) |
L | string? | Last fill price |
t | number | bigint (optional) | Trade ID of the last fill |
n | string? | Commission |
m | boolean? | Whether this order was the maker |
r | string? | Reject reason |
T | number | bigint | Transaction time (nanoseconds) |
BalanceUpdate
Code
| Field | Type | Meaning |
|---|---|---|
e | "balanceUpdate" | Event type discriminator |
E | number | bigint | Event time (nanoseconds) |
u | number | bigint | Update ID |
B | Balance[] | Balance entries |
Each Balance:
| Field | Type | Meaning |
|---|---|---|
a | string | Asset |
f | string | Free (available) balance |
c | string | Locked balance |
PositionReport
| Field | Type | Meaning |
|---|---|---|
e | "positionReport" | Event type discriminator |
E | number | bigint | Event time (nanoseconds) |
u | number | bigint | Last account-update timestamp (nanoseconds) |
A | number | bigint | Account reference |
P | PositionRow[] | Position entries |
Each PositionRow:
| Field | Type | Meaning |
|---|---|---|
t | string | Type |
s | string | Symbol |
a | NamedAmount[] | Named amounts for the position |
Each NamedAmount:
| Field | Type | Meaning |
|---|---|---|
t | string | Amount label, such as position or settlement_payout |
v | string | Decimal amount; position quantities are signed |
c | string? | Optional asset code, such as usd for settlement payouts |
o | ("YES" | "NO" | "UNSPECIFIED")? | Settlement outcome on settlement_payout amounts |
For a settled event-contract position, the terminal row includes a position
amount with value "0" and a settlement_payout amount. The payout amount
uses c: "usd" and includes o: "YES", "NO", or "UNSPECIFIED".
Terminal settlement rows are delivered only by the realtime positions@account
stream. The one-second positions@account@1s stream reports open-position
snapshots and omits those terminal rows.
ContractStatus
| Field | Type | Meaning |
|---|---|---|
e | "contractStatus" | Event type discriminator |
E | number | bigint | Event time (milliseconds) |
s | string | Symbol |
k | string | Event ticker |
c | string | Contract ticker |
i | number | bigint | Contract ID |
p | string? | Price |
o | string | Previous status |
n | string | New status |
What's next
- Order Book Reconstruction — how depth diffs become a live book
- RFQ Protocol — the request-for-quote maker flow
- Data Types — why timestamps are
bigintand prices are strings