Price Channel#
Retrieve the latest price data of a token. The fastest push frequency is 1 push per second. There will be no update if the event is not triggered.
Request URL
Please contact us dexapi@okx.com.
Request Parameters#
Parameter | Type | Required | Description |
---|---|---|---|
op | String | Yes | Operation, subscribe unsubscribe |
args | Array | Yes | List of subscribed channels |
channel | String | Yes | Channel name,price |
chainIndex | String | Yes | Unique identifier for the chain. (e.g., 1 for Ethereum. See ChainIndex) |
tokenContractAddress | String | Yes | Token contract address (e.g., 0x382bb369d343125bfb2117af9c149795c6c65c50) |
Response Parameters#
Parameter | Type | Description |
---|---|---|
event | String | Event, subscribe unsubscribe error |
arg | Object | Token contract address |
channel | String | Channel name |
chainIndex | String | Unique identifier for the chain. (e.g., 1 for Ethereum. See ChainIndex) |
tokenContractAddress | String | Token contract address (e.g., 0x382bb369d343125bfb2117af9c149795c6c65c50) |
code | String | Error code |
msg | String | Error message |
Push Data Parameters#
Parameter | Type | Description |
---|---|---|
arg | Object | Successfully subscribed channel |
> channel | String | Channel name |
> chainIndex | String | Unique identifier for the chain. (e.g., 1 for Ethereum. See ChainIndex) |
> tokenContractAddress | String | Token contract address (e.g., 0x382bb369d343125bfb2117af9c149795c6c65c50) |
data | Array | Subscribed data |
> time | String | Timestamp of the price, Unix timestamp format in milliseconds |
> price | String | Latest token price |
Request Example#
shell
{
"op": "subscribe",
"args": [
{
"channel": "price",
"chainIndex": "1",
"tokenContractAddress":"0x382bb369d343125bfb2117af9c149795c6c65c50"
}
]
}
Response Example#
200
Successful response example
{
"event": "subscribe",
"arg": {
"channel": "price",
"chainIndex": "1"
"tokenContractAddress":"0x382bb369d343125bfb2117af9c149795c6c65c50"
},
"connId": "a4d3ae55"
}
Failure response example
{
"event": "error",
"code": "60012",
"msg": "Invalid request: {\"op\": \"subscribe\", \"argss\":[{ \"channel\" : \"price\", \"chainIndex\" : \"1\", \"tokenContractAddress\" : \"0x382bb369d343125bfb2117af9c149795c6c65c50\"}]}",
"connId": "a4d3ae55"
}
Push data example
{
"arg": {
"channel": "price",
"chainIndex": "1"
"tokenContractAddress":"0x382bb369d343125bfb2117af9c149795c6c65c50"
},
"data": [
{
"time": "1716892020000",
"price": "26.458143090226812",
}
]
}