For the complete documentation index, see llms.txt. This page is also available as Markdown.

WebSocket API Reference

Full authentication, message, and stream reference for all WebSocket endpoints

WebSocket API Reference

Introduction

The Outpoll WebSocket API provides real-time streaming data for order books, probability charts, order updates, balance changes, and trade feeds.

All WebSocket connections use the wss:// protocol.


Authentication

Some endpoints are public (no authentication required): Order Book, Chart, Activity Feed, Last Trades.

Private endpoints (Order Updates, Balance Updates, Order Feed) require API key authentication.

API Key (in-band)

{
  "t": "AUTH",
  "d": {
    "apiKey": "<API_KEY>",
    "signature": "<SIGNATURE>",
    "timestamp": "<UNIX_EPOCH_SECONDS>"
  }
}

Signature is computed as:

Where path is the WebSocket endpoint path (e.g. /order/ws, /balance/ws). Timestamp drift tolerance is ±30 seconds.

Sign with API Key (Python)

All WebSocket examples below use the websockets library: pip install websockets


Order Book

Real-time price updates for prediction market outcomes. No authentication required.

All messages follow a common envelope:

Field
Type
Description

t

string

Message type

e

string

Event ID

d

array

Payload (list of outcome prices)

r

string

Error message (only on errors)

Message Types

Type
Direction
Description

SUBSCRIBE

Client

Subscribe to an event

SUBSCRIBED

Server

Subscription confirmed

UNSUBSCRIBE

Client

Unsubscribe from an event

UNSUBSCRIBED

Server

Unsubscription confirmed

REQUEST_DATA

Client

Request current prices

PRICES_DATA

Server

Full price snapshot

PRICES_DATA_DELTA

Server

Incremental price update

PING

Server

Heartbeat

ERROR

Server

Error message


Subscribe

Subscribe to price updates for an event.

Client -> Server

Server -> Client (confirmation)


Price Data

After subscribing, the server sends PRICES_DATA with the current state, and PRICES_DATA_DELTA on each change.

Server -> Client

Field
Type
Description

o

string

Outcome ID

c

number

Chance (last trade price)

b

number

Best bid

a

number

Best ask

PRICES_DATA_DELTA has the same format but only includes outcomes whose prices changed.

Python


Chart (Chance History)

Real-time probability chart data and historical OHLC-style probability aggregations. No authentication required.

All messages follow a common envelope:

Field
Type
Description

t

string

Message type

e

string

Event ID (UUID)

o

string[]

Outcome IDs (UUIDs)

d

object

Payload (varies by message type)

r

string

Error message (only on errors)


Subscribe

Subscribe to real-time probability updates for specific outcomes.

Client -> Server

Field
Type
Required
Description

t

string

Yes

SUBSCRIBE

e

string

Yes

Event ID

o

string[]

Yes

List of outcome IDs

Server -> Client (confirmation + initial data)

On subscribe, the server sends:

  1. A probability message with the last known value for each outcome

  2. A success confirmation

Python


Unsubscribe

Stop receiving probability updates for specific outcomes.

Client -> Server

Server -> Client

Python


Probability Update

Pushed in real-time when the probability of a subscribed outcome changes.

Server -> Client

Field
Type
Description

d.t

number

Timestamp (Unix epoch seconds)

d.p

number

Probability (0.0–1.0)


History Update

Pushed when a new aggregated data point is available for a subscribed outcome.

Server -> Client

Same data format as probability updates.


Request Historical Data

Request aggregated historical probability data for chart rendering.

Client -> Server

Field
Type
Required
Description

t

string

Yes

HISTORY

e

string

Yes

Event ID

o

string[]

Yes

Outcome IDs to fetch

d.p

string

No

Aggregation period (see table below). Omit for raw data

d.f

string

Yes

Start time (ISO 8601)

d.t

string

Yes

End time (ISO 8601)

Aggregation Periods

Code
Duration

1s

1 second

5s

5 seconds

5M

5 minutes

10M

10 minutes

30M

30 minutes

1H

1 hour

3H

3 hours

4H

4 hours

6H

6 hours

1d

1 day

7d

1 week

1m

1 month

You can also pass a custom number of seconds as a string (e.g. "300" for 5-minute buckets).

Server -> Client

Response data is a map of outcomeId -> array of data points:

Field
Type
Description

t

number

Period end (Unix epoch seconds)

p

number

Close probability (0.0–1.0)

The first point in each array is an anchor — the last known probability value at or before the requested from time. This allows charts to draw a continuous line from the left edge.

If no data exists in the requested range, the server returns two points (at from and to) with the last known probability, creating a flat line.

Python — Request Historical Data


Chart History REST Endpoint

The same historical data is also available via REST.

Query Parameters

Parameter
Type
Required
Description

period

string

Yes

Aggregation period code (e.g. 1H)

from

string

Yes

Start time (ISO 8601)

to

string

Yes

End time (ISO 8601)

Example

Response 200 OK

Python


Order Updates

Real-time notifications about your order executions and TP/SL status changes.

Requires authentication. Send an AUTH message after connecting.


Authenticate

Option 1 — JWT Token

Signature: base64url_no_padding(HMAC-SHA256(secret, timestamp + "GET" + "/order/ws"))

Server -> Client (success)

Server -> Client (failure)


Order Update

Sent when an order is placed or fails.

Server -> Client

Field
Type
Description

d.i

string

Order ID

d.u

string

User ID

d.s

string

Status — SUCCESS or FAILED


TP/SL Update

Sent when a take-profit or stop-loss order changes state.

Server -> Client

Field
Type
Description

d.i

string

Order ID

d.u

string

User ID

d.a

string

Asset ID

d.q

number

Quantity

d.tpp

number

Take-profit price

d.slp

number

Stop-loss price

d.s

string

Status


Server Ping

The server sends a heartbeat every 15 seconds. No response required.

Server -> Client

Python


Balance Updates

Real-time balance changes and transaction updates.

Requires authentication. Send an AUTH message after connecting.


Authenticate

Option 1 — JWT Token

Signature: base64url_no_padding(HMAC-SHA256(secret, timestamp + "GET" + "/balance/ws"))

After successful authentication, the server sends your current balances wrapped in a success message:

Server -> Client (auth success + initial balances)

Field
Type
Description

t

string

Message type (success)

d.l

array

List of balances

d.l[].i

string

Asset ID

d.l[].b

number

Balance

d.l[].f

number

Free balance

r

null

Error (null on success)


Balance Update

Sent when any balance changes (trade, deposit, withdrawal).

Server -> Client

Field
Type
Description

u

string

User ID

a

string

Asset ID

aop

number

Average open price

c

number

Cost

b

number

Balance

f

number

Free balance

Python


Trade & Activity Feed

The history service exposes three separate WebSocket endpoints.


Order Feed

Real-time order status updates for the authenticated user.

Requires authentication. Send an AUTH message after connecting.

Signature: base64url_no_padding(HMAC-SHA256(secret, timestamp + "GET" + "/order/ws"))

Server -> Client (success)

Python


Activity Feed

Real-time activity updates (trades, position changes) with subscribe/unsubscribe.

All messages follow a common envelope:

Client -> Server (subscribe)

Client -> Server (unsubscribe)

Python


Last Trades Feed

Real-time broadcast of the latest trades across the platform. No authentication or subscription required.

Python


Errors

WebSocket error messages follow this format:

Common errors:

Error
Cause

Invalid or missing credentials

API key auth failed

No outcome IDs provided

Subscribe without outcome IDs

Invalid time range

from is after to

Invalid period

Unrecognized aggregation period

Unknown message type

Unsupported t value

Last updated

Was this helpful?