One Trading API
REST APIWebSocket API
REST APIWebSocket API
  1. WebSocket API
  • Introduction
  • Authenticate
  • Subscribe
  • Ping / Pong
  • Trading
    • Introduction
    • Dead Man Switch (Auto Cancellation)
    • Create Order
    • Cancel All Orders
    • Cancel Order by Client ID
    • Cancel Order by Order ID
    • Margin Update
    • Settlement
    • Funding Payment
    • Order Booked
    • Order Rejected
    • Order Closed
    • Trade Executed
    • Order Fully Filled
    • Balance Adjustment
  • Orderbook
    • Introduction
    • Orderbook Snapshot
    • Orderbook Update
  • Price Ticks
    • Introduction
    • Price Tick
  • Book Ticker
    • Introduction
    • Book Tick
  1. WebSocket API

Subscribe

Before you can send messages to a particular WebSocket channel, you must first subscribe to it.
Some of the market data websocket channels take an instrument_codes property alongside the name of the channel.

Subscription Request#

{
    "type": "SUBSCRIBE",
    "channels": [
      {
        "name": "TRADING"
      }
    ]
}
SubscriptionRequest
type
enum<string> 
required
Allowed value:
SUBSCRIBE
channels
array [object {2}] 
required
name
string 
required
Channel name to subscribe to
instrument_codes
array[string]
optional
A list of market ids.

Subscription Response#

Success#

{
    "type": "SUBSCRIPTIONS",
    "channels": [
        {
            "name": "TRADING"
        }
    ],
    "time": 1731671164898119453
}
SubscriptionSuccessResponse
type
enum<string> 
required
Allowed value:
SUBSCRIPTIONS
channels
array [object {1}] 
required
name
string 
required
Channel name subscribed to
time
integer 
required
The time the message was sent in nanoseconds

Error#

{
    "error": "Invalid channel."
}
SubscriptionErrorResponse
error
enum<string> 
required
The reason the subcription failed
Allowed value:
SUBSCRIBE
Previous
Authenticate
Next
Ping / Pong
Built with