Recent Trades
{{WSS_SERVER}}/ws
Modified at: 8 个月前
Recent Trades is used to subscribe to real-time updates on recent trades for a specific trading pair on our platform.
Information
Update Speed: Real-time
Initial Limit: 20 data points
Message Structure
Send Message
- type: Specifies the type of WebSocket message.
- Type: String.
- Value: "subscribe"
- channel: Indicates the type of data to subscribe to (e.g., order book updates).
- Type: String.
- Value: "trade"
- id: A unique identifier for the subscription request. Write randomly or use any unique identifier.
- Type: String.
- Example. "random string 001"
- symbol: Specifies the trading pair for which the subscriber wants to receive order book updates.
- Type: String.
- Example: "WBTCUSDT"
Subscribe Example
{
"type": "subscribe",
"channel": "trade",
"id": "random string",
"symbol": "WBTCUSDT"
}
Unsubscribe Example
{
"type": "unsubscribe",
"channel": "trade",
"id": "random string",
"symbol": "WBTCUSDT"
}
Initial Message
- id: A unique identifier for the message, used to match responses to specific requests.
- Type: String
- Value: "random string"
- type: Specifies the type of WebSocket message.
- Type: String
- Value: "init"
- channel: Indicates the type of data being updated (e.g., trade updates).
- Type: String
- Value: "trade"
- symbol: Specifies the trading pair for which the order book is being updated.
- Type: String
- Example: "WBTCUSDT"
- timestamp: The timestamp when the response was generated
- Type: Integer (UNIX timestamp in milliseconds)
- Examples: 1704696764925
- data: An array containing trade information for each recent trade.
- price: The price at which the trade occurred.
- Type: Number
- quantity: The quantity of the asset traded.
- Type: Number
- isBuyerMaker Indicates whether the buyer is the market maker.
- Type: Boolean
- buyerOrderId: The current timestamp when the update message is sent.
- Type: Number
- sellerOrderId: The unique identifier of the seller's order.
- Type: Number
- tradeTime: The timestamp when the trade occurred.
- Type: Integer (UNIX timestamp in milliseconds & UTC)
Response Example
- Type: Integer (UNIX timestamp in milliseconds & UTC)
- price: The price at which the trade occurred.
{
"error": false,
"id": "random string",
"type": "init",
"channel": "trade",
"symbol": "WBTCUSDT",
"timestamp": 1704705946148,
"data": [
{
"price": 43883.97,
"quantity": 0.05,
"isBuyerMaker": false,
"buyerOrderID": 1200899,
"sellerOrderID": 1200898,
"tradeTime": 1704705361774,
"id": 50371
},
{
"price": 43883.96,
"quantity": 0.1,
"isBuyerMaker": true,
"buyerOrderID": 1200909,
"sellerOrderID": 1200910,
"tradeTime": 1704705386377,
"id": 50373
}
]
}
Update Message
- type: Specifies the type of WebSocket message.
- Type: String
- Value: "update"
- channel: Indicates the type of data being updated (e.g., trade updates).
- Type: String
- Value: "trade"
- symbol: Specifies the trading pair for which the order book is being updated.
- Type: String
- Example: "WBTCUSDT"
- data: An array containing trade information for each recent trade.
- price: The price at which the trade occurred.
- Type: Number
- quantity: The quantity of the asset traded.
- Type: Number
- isBuyerMaker Indicates whether the buyer is the market maker.
- Type: Boolean
- buyerOrderId: The current timestamp when the update message is sent.
- Type: Number
- sellerOrderId: The unique identifier of the seller's order.
- Type: Number
- tradeTime: The timestamp when the trade occurred.
- Type: Integer (UNIX timestamp in milliseconds & UTC)
Response Example
{ "type": "update", "channel": "trade", "symbol": "WBTCUSDT", "data": [ { "price": 35566.14, "quantity": 0.02, "isBuyerMaker": false, "buyerOrderID": 178523, "sellerOrderID": 9563, "tradeTime": 1700822401238 }, { "price": 35576.47, "quantity": 0.01, "isBuyerMaker": false, "buyerOrderID": 178523, "sellerOrderID": 9562, "tradeTime": 1700822401238 } ] }
- Type: Integer (UNIX timestamp in milliseconds & UTC)
- price: The price at which the trade occurred.
请求参数
无
Modified at 8 个月前