Skip to main content

Connection

Establishes a WebSocket connection for real-time data streams.

Connection URL

EnvironmentURL
Productionwss://derivatives.api.dlt-finance.com/v1/ws
Integrationwss://derivatives.api.dlt-int-01.int.dlt-finance.com/v1/ws

No authentication is required for public channels. Private channels (orders, trades, margin) require authentication — see below.

Client → Server Messages

All client messages are JSON objects with an op field.

Subscribe — begin receiving data for one or more topics:

{"op": "subscribe", "args": ["orderbook:BTCUSDC_PERP", "orderbook:ETHUSD_PERP"]}

Unsubscribe — stop receiving data for a topic:

{"op": "unsubscribe", "args": ["orderbook:BTCUSDC_PERP"]}

Authenticate — authenticate the connection for private channels:

{"op": "authenticate", "data": {"publicKey": "aabbccdd...", "nonce": "1531816217872000000", "signature": "eeff0011..."}}

Ping — check connection liveness:

{"op": "ping"}

Server → Client Messages

Subscribe acknowledgement — sent after each successful subscription:

{"op": "subscribed", "channel": "orderbook:BTCUSDC_PERP"}

Unsubscribe acknowledgement — sent after each successful unsubscription:

{"op": "unsubscribed", "channel": "orderbook:BTCUSDC_PERP"}

Authenticate acknowledgement — sent after successful authentication:

{"op": "authenticated"}

Error — sent when a request cannot be fulfilled:

{
"op": "error",
"code": "UNKNOWN_SYMBOL",
"message": "Unknown symbol: FOOBAR_PERP",
"args": ["orderbook:FOOBAR_PERP"]
}

Error codes: UNKNOWN_SYMBOL, ALREADY_SUBSCRIBED, NOT_SUBSCRIBED, INVALID_MESSAGE, AUTHENTICATION_REQUIRED, AUTHENTICATION_FAILED.

Pong — response to a client ping:

{"op": "pong"}

Keepalive — the server sends WebSocket-level ping frames at ~1 minute intervals. If no pong is received within the timeout, the connection is closed. Most WebSocket libraries handle pong responses automatically.

Reconnect — server requests the client to reconnect. Sent before the server closes the connection (e.g. when the connection reaches its maximum lifetime). Clients should reconnect immediately upon receiving this message. After sending the reconnect message, the server waits ~3 seconds before sending a WebSocket close frame (code 1001 Going Away).

{"op": "reconnect", "message": "please reconnect"}

Behaviour Notes

  • One connection supports any number of simultaneous topic subscriptions.
  • Subscribing to an already-subscribed topic returns ALREADY_SUBSCRIBED.
  • Unsubscribing from a topic not currently subscribed returns NOT_SUBSCRIBED.
  • Data begins flowing immediately after a successful subscribe acknowledgement.
  • The server closes the connection after 60 s of inactivity (no messages in either direction).
  • Connections have a maximum lifetime. When the limit is reached, the server sends a reconnect message and closes the connection shortly after. Clients should implement automatic reconnection logic to handle this gracefully.

Authentication

Private channels require authentication before subscribing. Authentication uses the same ed25519 signature scheme as the REST API, with a fixed method and path.

Signature construction:

message = GET/v1/ws{nonce}

Send the authenticate message with your public key, nonce, and signature:

{"op": "authenticate", "data": {"publicKey": "aabbccdd...", "nonce": "1531816217872000000", "signature": "eeff0011..."}}

On success the server responds with:

{"op": "authenticated"}

On failure the server responds with an error:

{"op": "error", "code": "AUTHENTICATION_FAILED", "message": "Invalid signature"}

Subscribing to a private channel without authenticating first returns:

{"op": "error", "code": "AUTHENTICATION_REQUIRED", "message": "Authentication required for channel: orders", "args": ["orders"]}
  • Authentication applies for the lifetime of the connection.
  • Public channels continue to work without authentication.
  • Private channels: orders, trades, margin, liquidations.