Candlesticks Channel#
Retrieve the candlesticks data of a token. The fastest push frequency is 1 push per second. 
Request URL
Please contact us dexapi@okx.com.
Request Parameters#
| Parameter | Type | Required | Description | 
|---|---|---|---|
| op | String | Yes | Operation, subscribeunsubscribe | 
| args | Array | Yes | List of subscribed channels | 
| channel | String | Yes | Channel name. dex-token-candle1sdex-token-candle1mdex-token-candle3mdex-token-candle5mdex-token-candle15mdex-token-candle30mdex-token-candle1Hdex-token-candle2Hdex-token-candle4Hdex-token-candle6Hdex-token-candle12Hdex-token-candle1Mdex-token-candle3Mdex-token-candle1Wdex-token-candle1Ddex-token-candle2Ddex-token-candle3Ddex-token-candle5Ddex-token-candle6Hutcdex-token-candle12Hutcdex-token-candle1Dutcdex-token-candle2Dutcdex-token-candle3Dutcdex-token-candle5Dutcdex-token-candle1Wutcdex-token-candle1Mutcdex-token-candle3Mutc | 
| chainIndex | String | Yes | Unique identifier for the chain. (e.g., 1 for Ethereum. See ChainIndex) | 
| tokenContractAddress | String | Yes | Token contract address,for EVM please pass all-lowercase addresses (e.g., 0x382bb369d343125bfb2117af9c149795c6c65c50) | 
Response Parameters#
| Parameter | Type | Description | 
|---|---|---|
| event | String | Event, subscribeunsubscribeerror | 
| 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 | 
| > ts | String | Opening time of the candlestick, Unix timestamp format in milliseconds, e.g. 1597026383085 | 
| > o | String | Open price | 
| > h | String | highest price | 
| > l | String | Lowest price | 
| > c | String | Close price | 
| > vol | String | Trading volume, with a unit of base currency | 
| > volUsd | String | Trading volume, with a unit of usd. | 
| > confirm | String | The state of candlesticks. 0: represents that it is uncompleted1: represents that it is completed. | 
Request Example#
shell
{
  "op": "subscribe",
  "args": [
    {
      "channel": "dex-token-candle1s",
      "chainIndex": "1",
      "tokenContractAddress":"0x382bb369d343125bfb2117af9c149795c6c65c50"
    }
  ]
}
Response Example#
200
Successful response example
{
  "event": "subscribe",
  "arg": {
    "channel": "dex-token-candle1s",
    "chainIndex": "1"
    "tokenContractAddress":"0x382bb369d343125bfb2117af9c149795c6c65c50"
  },
  "connId": "a4d3ae55"
}
Failure response example
{
  "event": "error",
  "code": "60012",
  "msg": "Invalid request: {\"op\": \"subscribe\", \"argss\":[{ \"channel\" : \"dex-token-candle1s\", \"chainIndex\" : \"1\", \"tokenContractAddress\" : \"0x382bb369d343125bfb2117af9c149795c6c65c50\"}]}",
  "connId": "a4d3ae55"
}
Push data example
{
  "arg": {
    "channel": "dex-token-candle1s",
    "chainIndex": "1"
    "tokenContractAddress":"0x382bb369d343125bfb2117af9c149795c6c65c50"
  },
  "data": [
    [
      "1597026383085",
      "8533.02",
      "8553.74",
      "8527.17",
      "8548.26",
      "529.5858061",
      "226348.0482",
      "0"
    ]
  ]
}
