Messages

Describe the general message format of the stream protocol.

Fields

WebSocket messages are JSON objects with the following fields:

FieldDescriptionFormat
ttopic
eeventpossible values:

- tdx:subscribe
- tdx:unsubscribe
- tdx:order_create
- tdx:order_cancel
- tdx:cancel_on_disconnect
ddataJSON
aauthenticationJWT token

Topics

Interactions are performed on topics:

TopicDescriptionTypeFormat
<pair>@tradesstream to receive trade updatespublic^[a-zA-Z0-9\-]{1,10}\/[a-zA-Z0-9\-]{1,10}@trades$
<pair>@depthstream to receive order book updates.

A level can be specified by appending it to the topic:
<pair>@depth10
<pair>@depth50
<pair>@depth100
<pair>@depth500

A refresh speed can be specified by appending it to the topic:
<pair>@depth@100ms
<pair>@depth@500ms
<pair>@depth@1000ms
<pair>@depth@5000ms

level and speed can be combined:
<pair>@depth10@100ms
public^[a-zA-Z0-9\-]{1,10}\/[a-zA-Z0-9\-]{1,10}@(depth(10|50|100|500)?(@(100|500|1000|5000)ms)?)$
<subAccountId>@subaccount-ordersstream to create orders and receive updatesprivate^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}@subaccount-orders$

Subscribing to a topic

First one needs to subscribe to a topic, by sending a message with an event tdx:subscribe. For example, to subscribe to the topic streaming the trades of the BTC/CHF pair, the following message will be sent:

{
  "t": "BTC/CHF@trades",
  "e": "tdx:subscribe"
}
{
  "t": "BTC/CHF@trades",
  "e": "tdx:subscription_received"
}

Unsubscribing from a topic

{
  "t": "BTC/CHF@trades",
  "e": "tdx:unsubscribe"
}
{
  "t": "BTC/CHF@trades",
  "e": "tdx:unsubscription_succeeded"
}



  © 2018-2023 Taurus SA. All rights reserved.