获取价格#
获取代币最新价格。
请求地址#
GET https://web3.okx.com/api/v5/dex/market/price
请求参数#
Parameter | Type | Required | Description |
---|---|---|---|
chainIndex | String | 是 | 链的唯一标识。 (如1 代表Ethereum。更多可查看这里。) |
tokenContractAddress | String | 是 | 币种合约地址 (如:0x382bb369d343125bfb2117af9c149795c6c65c50) |
响应参数#
Parameter | Type | Description |
---|---|---|
chainIndex | String | 链的唯一标识。 (如 1 代表 Ethereum,66 代表 OKTC 。更多可查看这里。) |
tokenContractAddress | String | 币种合约地址 |
time | String | 价格的时间,Unix 时间戳格式,用毫秒表示 |
price | String | 最新代币价格 |
请求示例#
shell
curl --location --request POST 'https://web3.okx.com/api/v5/dex/market/price' \
--header 'Content-Type: application/json' \
--header 'OK-ACCESS-PROJECT: 86af********d1bc' \
--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": "66",
"tokenContractAddress":"0x382bb369d343125bfb2117af9c149795c6c65c50"
}
]'
响应示例#
200
{
"code":"0",
"data":[
{
"chainIndex": "1",
"tokenContractAddress": "0x382bb369d343125bfb2117af9c149795c6c65c50",
"time": "1716892020000",
"price": "26.458143090226812"
}
],
"msg":""
}