Index Data
The index price of different assets to be subscribed are controlled by the parameters in the subscription message listed below.
/trading-api/v1/index-data
Operations
SEND/trading-api/v1/index-data
Subscribe
Multiple subscriptions could be opened within the same websocket.
The index price of different assets 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": "indexPrice",
"assetSymbol": "USDC"
}
}
This example has been generated automatically.
RECEIVE/trading-api/v1/index-data
After subscribing, the server sends :
- an acknowledgement
- followed by a snapshot
- 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"}}This example has been generated automatically.
- #2Snapshot
Snapshot to the subscribed index price data
objectExamples
{"type": "snapshot","dataType": "V1TAIndexPrice","data": {"assetSymbol": "USDC","price": "1.0000","updatedAtDatetime": "2024-06-29T06:29:50.500Z","updatedAtTimestamp": "1719642590000"}}This example has been generated automatically.
- #3Update
Incremental update to the subscribed index price data
objectExamples
{"type": "update","dataType": "V1TAIndexPrice","data": {"assetSymbol": "USDC","price": "1.0000","updatedAtDatetime": "2024-06-29T06:29:50.500Z","updatedAtTimestamp": "1719642590000"}}This example has been generated automatically.
RECEIVE/trading-api/v1/index-data
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/index-data
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/index-data
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/index-data
Unsubscribe
Closes every open subscription matching the given topic and asset symbol, while keeping your websocket opened.
Accepts the following message:
Let you unsubscribe to a given topic
Examples
{
"method": "unsubscribe",
"id": "1611082473000",
"jsonrpc": "2.0",
"type": "command",
"params": {
"topic": "indexPrice",
"assetSymbol": "USDC"
}
}
This example has been generated automatically.
RECEIVE/trading-api/v1/index-data
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"
}
}
This example has been generated automatically.
RECEIVE/trading-api/v1/index-data
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"
}
}