Spot
This document outlines how to establish and maintain a WebSocket connection for Spot trading via two supported authentication methods: Token and API Key.
Token Connection
1. Overview
The client sends a WebSocket request with a
token
in the header.A subscription message must be sent to receive real-time data upon successful connection.
2. Connection Details
Request Path:
3. Request Header
token
string
Yes
Token generated after login
4. Subscription Message Format
API Key Connection
1. Overview
The client sends a WebSocket request with an
api-key
in the header.A subscription message must be followed to start receiving real-time messages.
2. Connection Details
Request Path:
3. Request Header
api-key
string
Yes
API key generated on the frontend
4. Subscription Message Format
Receiving Messages
1. Connection Responses
Connect Success:
"connect success"
Subscribe Success:
"sub success"
2. Message Format
Messages are compressed in binary format using GZIP.
Decompress using your language's GZIP library.
Example (Base64 Encoded, Gzipped):
Decompressed Message (Example):
Event Types
1. Account Update: outboundAccountPosition
outboundAccountPosition
2. Order Status Update: executionReport
executionReport
Order Status (X):
FILLED
: Fully filledPART_FILLED
: Partially filledCANCELED
: Cancelled successfullyPENDING_CANCEL
: Cancellation in progress
3. System Close Notification
V. Heartbeat Mechanism
Client must send a ping every 30 seconds:
Server responds with pong:
The connection will be closed if no ping is received in 40 seconds.
Last updated