获取综合币价#
综合币价指通过多个第三方数据源的价格,计算出来的一个币价。
批量查询代币的综合价格,每次最多可以批量查询 100 个代币的综合价格。
按数组格式传递请求参数。
请求路径#
POST https://web3.okx.com/api/v6/dex/index/current-price
请求参数#
| Parameter | Type | Required | Description | 
|---|---|---|---|
| chainIndex | String | 是 | 链唯一标识 | 
| tokenContractAddress | String | 是 | 代币地址 1:传""代表查询对应链的主链币2:传具体的代币合约地址,代表查询对应的代币 | 
响应参数#
| Parameter | Type | Description | 
|---|---|---|
| price | String | 代币价格,单位为美元 | 
| time | String | 价格的时间,Unix 时间戳格式,用毫秒表示 | 
| chainIndex | String | 链唯一标识 | 
| tokenContractAddress | String | 代币地址 | 
请求示例#
shell
curl --location --request POST 'https://web3.okx.com/api/v6/dex/index/current-price' \
--header 'Content-Type: application/json' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z' \
--data-raw '[
        {
            "chainIndex": "1",
            "tokenContractAddress":"0xc18360217d8f7ab5e7c516566761ea12ce7f9d72"
        }
    ]'
响应示例#
200
{
    "code": "0",
    "msg": "success",
    "data": [
        {
            "chainIndex": "1",
            "tokenContractAddress": "0xc18360217d8f7ab5e7c516566761ea12ce7f9d72"
            "time": "1716892020000",
            "price": "26.458143090226812",
        }
   ]
}
