# Websocket Market Data

# 1. Trade Streams

The feature pushes real-time information as a snapshot when a trade is made. Each transaction or trade has a unique buyer and seller.

Subscription Type

dataType is <symbol>@trade, such as BTC-USDT@trade ETH_USDT@trade

Subscription Example

{"id":"24dd0e35-56a4-4f7a-af8a-394c7060909c","dataType":"BTC-USDT@trade"}

Subscription Parameters

Parameters Type Required Description
symbol String YES There must be a dash "-" in the trading pair symbol, e.g., BTC-USDT

Push Data

Return Parameters Field Description
dataType The type of data subscribed, such as BTC-USDT@trade
data Push data
e Event type
E Event time
s Symbol
t Trade ID
p Price
q Quantity
T Trade time
m Is the buyer the market maker?
  # Response
  {
      "data": {
            "E": 1649832413551,
            "T": 1649832413512,
            "e": "trade",
            "p": "40125.48",
            "q": "0.007146",
            "s": "BTC-USDT",
            "t": "33685717",
            "m": true
     },
     "dataType": "BTC-USDT@trade"
  }

# 2. Kline Streams

The Kline Stream push updates to the (current) kline of requested type every second.

Subscription Type

dataType is <symbol>@kline_<interval>, such as BTC-USDT@kline_1min

Subscription Example

{"id":"e745cd6d-d0f6-4a70-8d5a-043e4c741b40","dataType":"BTC-USDT@kline_1min"}

** Subscription Parameters**

Parameters Type Required Field Description Description
symbol String YES Trading pair There must be a dash "-" in the contract name, e.g., BTC-USDT
interval String YES Kline type Parameter description, e.g., minute, hour, week, etc. kline type ,1min, 5min, 15min, 30min, 60min, 1day

Remarks

For now, only 1 min kline data is provided

klineType Field Description
1min 1 min Kline

Push Data

Return Parameters Field Description
dataType The type of data subscribed, such as BTC-USDT@kline_1min
data Push data
e Event type
E Event time
s Symbol
K Kline data
t Kline start time
T Kline close time
s Symbol
i Interval
o Open price
c Close price
h High price
l Low price
v Base asset volume
n Number of trades
q Quote asset volume
 # Response
{
"data": {
"E": 1649832726550,
       "K": {
        "T": 1649832779999,
         "c": "40017.48",
         "h": "40027.83",
         "i": "1min",
         "l": "40017.48",
         "n": 13,
         "o": "40025.42",
         "q": "2693.492344",
         "s": "BTC-USDT",
         "t": 1649832720000,
         "v": "0.067295"
   },
       "e": "kline",
       "s": "BTC-USDT"
},
 "dataType": "BTC-USDT@kline_1min"
}

# 3. Partial Book Depth Streams

Partial book depth information is pushed every second, fixed at level 20. Some trading pairs may not reach level 20. 100 files can be selected

Subscription Type

   dataType is <symbol>@depth<level>,as BTC-USDT@depth, BTC-USDT@depth20, BTC-USDT@depth100 
 {"id":"975f7385-7f28-4ef1-93af-df01cb9ebb53","dataType":"BTC-USDT@depth"}

Subscription Parameters

Parameters Type Required Field Description Description
symbol String YES Trading pair symbol There must be a dash "-" in the trading pair, e.g., BTC-USDT

Push Data

Return Parameters Field Description
dataType The type of data subscribed, such as BTC-USDT@depth
data Push data
bids Bids to be updated
asks Asks to be updated
 # Response
{
 "dataType": "BTC-USDT@depth",
 "data": {
 "bids": [
     [
         "43302.00", // Price level to be updated
         "0.000021"  // Quantity
     ]
 ],
     "asks": [
     [
         "43499.00", // Price level to be updated
         "0.000021"  // Quantity
     ]
 ]
}
}
Last Updated: 7/27/2022, 11:04:42 AM