Anonymous Trades
This allows simultaneous trade subscriptions to multiple markets. Additionally, instead of sending trades one by one, trades are sent in batches.
Upon subscribing to a market, the client will first receive a snapshot of the latest 100 trades, followed by batches of trade updates.
Anonymous trades from different markets to be subscribed to are controlled by the parameters in the subscription message listed below.
/trading-api/v1/market-data/trades
Operations
SEND/trading-api/v1/market-data/trades
Subscribe
Multiple subscriptions could be opened within the same websocket.
The trades of different markets to be subscribed are controlled by the parameters in the subscription message listed below.
Accepts the following message:
Let you subscribe to a given topic
Examples
{
"method": "subscribe",
"id": "1611082473000",
"jsonrpc": "2.0",
"type": "command",
"params": {
"topic": "anonymousTrades",
"symbol": "BTCUSD"
}
}
This example has been generated automatically.
RECEIVE/trading-api/v1/market-data/trades
After subscribing, the server sends :
- an acknowledgement
- then an initial snapshot with the latest 100 trades upon subscription.
- followed by incremental updates.
Sends one of the following messages:
- #1Acknowledgment
Confirm the topic being subscribed
objectExamples
{"id": "1611082473000","jsonrpc": "2.0","result": {"responseCodeName": "OK","responseCode": "200","message": "Successfully subscribed (anonymousTrades BTCUSD)"}}This example has been generated automatically.
- #2Snapshot
Initial full state of the subscribed trade data
objectExamples
{"type": "snapshot","dataType": "V1TAAnonymousTradeUpdate","data": {"symbol": "string","createdAtDatetime": "string","publishedAtTimestamp": "string","trades": [{"tradeId": "100069000000063765","isTaker": true,"price": "23404.8636","createdAtTimestamp": "1721879160353","quantity": "0.00029411","publishedAtTimestamp": "1721879162124","side": "SELL","createdAtDatetime": "2024-07-25T03:46:00.353Z","symbol": "BTCUSDC","otcMatchId": "1","otcTradeId": "200069000000063765","clientOtcTradeId": "300069000000063765"},{"tradeId": "100069000000063764","isTaker": false,"price": "23104.8636","createdAtTimestamp": "1721879160355","quantity": "0.00029412","publishedAtTimestamp": "1721879162125","side": "BUY","createdAtDatetime": "2024-07-25T03:46:00.355Z","symbol": "ETHUSDC","otcMatchId": "2","otcTradeId": "200069000000063766","clientOtcTradeId": "300069000000063766"}]}}This example has been generated automatically.
- #3Update
Incremental update to the subscribed trade data
objectExamples
{"type": "update","dataType": "V1TAAnonymousTradeUpdate","data": {"symbol": "string","createdAtDatetime": "string","publishedAtTimestamp": "string","trades": [{"tradeId": "100069000000063765","isTaker": true,"price": "23404.8636","createdAtTimestamp": "1721879160353","quantity": "0.00029411","publishedAtTimestamp": "1721879162124","side": "SELL","createdAtDatetime": "2024-07-25T03:46:00.353Z","symbol": "BTCUSDC","otcMatchId": "1","otcTradeId": "200069000000063765","clientOtcTradeId": "300069000000063765"}]}}This example has been generated automatically.
RECEIVE/trading-api/v1/market-data/trades
In case of invalid subscription message, an error rejection would be sent.
Sends the following message:
Explain why the topic could not be subscribed
Examples
{
"id": "1611082473000",
"jsonrpc": "2.0",
"error": {
"code": "-32602",
"errorCode": "29013",
"errorCodeName": "'abcde' is not a valid topic"
}
}
This example has been generated automatically.
SEND/trading-api/v1/market-data/trades
Keepalive
In case nothing is subscribed to, keep the websocket connection alive.
Accepts the following message:
Examples
{
"method": "keepalivePing",
"params": {},
"id": "1611082473000",
"jsonrpc": "2.0",
"type": "command"
}
This example has been generated automatically.
RECEIVE/trading-api/v1/market-data/trades
Acknowledgement returned by the server in response to a keepalive-ping.
Sends the following message:
Examples
{
"id": "1611082473000",
"jsonrpc": "2.0",
"result": {
"responseCodeName": "OK",
"responseCode": 200,
"message": "Keep alive pong"
}
}
This example has been generated automatically.
SEND/trading-api/v1/market-data/trades
Unsubscribe
Let you unsubscribe a specific topic while keeping your websocket opened.
Accepts the following message:
Let you unsubscribe to a given index
Examples
{
"method": "unsubscribe",
"id": "1611082473000",
"jsonrpc": "2.0",
"type": "command",
"params": {
"topic": "anonymousTrades",
"symbol": "BTCUSD"
}
}
This example has been generated automatically.
RECEIVE/trading-api/v1/market-data/trades
After unsubscribing, the server sends an acknowledgement.
Sends the following message:
Confirm the topic being unsubscribed
Examples
{
"id": "1611082473000",
"jsonrpc": "2.0",
"result": {
"responseCodeName": "OK",
"responseCode": "200",
"message": "Successfully unsubscribed (anonymousTrades BTCUSD)"
}
}
This example has been generated automatically.
RECEIVE/trading-api/v1/market-data/trades
In case of invalid unsubscription message, an error rejection would be sent.
Sends the following message:
Explain why the topic could not be unsubscribed
Examples
{
"id": "1611082473000",
"jsonrpc": "2.0",
"error": {
"code": "-32602",
"errorCode": "29013",
"errorCodeName": "'abcde' is not a valid topic"
}
}