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

Futures Account Streams

Private real-time streams for your futures positions, orders and margin

Private futures streams push changes to your own account as they happen. Use them together with the Futures REST API: REST for snapshots and actions, the streams for live updates.

Service host

wss://futures-trading-service.outpoll.com
Path
Stream

/ws/account

Account — positions, orders, conditional orders and TP/SL levels

/ws/margin-call

Margin Call — warnings when your cross margin gets close to liquidation

Each stream is a separate connection with its own authentication. You can keep both open at the same time.

Authentication

The connection opens without credentials. Authenticate with the first message, signed with your API key — the same key and signature scheme as the private REST endpoints, with an empty body:

message   = ts + "GET" + path
signature = Base64URL_NoPadding( HMAC_SHA256( key = Base64URL_Decode(apiSecret), message ) )
Part
Value

ts

Current Unix time in seconds, as a string; must be within ±30 seconds of server time

path

The stream path: /ws/account or /ws/margin-call

{
  "t": "AUTH",
  "d": {
    "key": "your-api-key",
    "ts": "1790835600",
    "sig": "signature"
  }
}

On success the server replies:

  • Send AUTH within 5 seconds of connecting. Otherwise the server closes the connection with code 1008 (auth required).

  • A wrong signature, a stale ts, or an unknown, expired or blocked key closes the connection with code 1008 immediately.

  • Each AUTH counts against your API key's rate limits.

  • Until you are authenticated, every message other than AUTH is ignored, including ping.

  • A user access token is accepted too: {"t":"AUTH","d":{"t":"<access-token>"}}. Browser clients on an Outpoll site are authenticated from the session cookie and don't need to send AUTH.

  • Don't send an Origin header from a non-browser client. A connection with an Origin that is not an Outpoll site is rejected during the handshake (403).

Message Envelope

Server messages are JSON text frames. The AUTH acknowledgement uses t / d:

Field
Type
Description

t

string

Message type, AUTH

d

object

{"ok": true}

Data messages have a stream-specific shape — see Account and Margin Call.

Ping / Pong

Send the plain text ping (not JSON) to keep the connection alive; the server answers with the plain text pong. Standard WebSocket ping control frames are answered as well.

Send a ping every 20–30 seconds. A ping sent before authentication gets no answer.

Errors

The streams send no error messages. Problems are reported by closing the connection:

Close code
Reason
Cause

1008

auth required

No AUTH within 5 seconds, or an AUTH that fails verification

Messages the server does not understand (invalid JSON, unknown types, subscription requests) are ignored.

Delivery and Reconnects

  • There is no initial snapshot and no replay. A stream only carries changes that happen while you are connected.

  • Delivery is best-effort; messages carry no sequence numbers.

  • After connecting or reconnecting: authenticate first, then load the current state over REST, then apply stream messages on top of it.

  • Reconnect with exponential backoff and jitter (for example 1 s, 2 s, 4 s … up to 30 s).

  • Every open, authenticated connection of the same user receives every message.

Pages

  • Account — /ws/account

  • Margin Call — /ws/margin-call

Was this helpful?