Get historical coin priceRetrieve historical price data for a specific coin. This includes past on-chain data such as the coin’s previous price points at different times.
GET https://www.okx.com/api/v5/waas/coin/historical-price
Parameter | Type | Required | Description |
---|---|---|---|
chainId | String | Yes | Unique identifier of the chain |
tokenAddress | String | No | If not passed, query the mainnet coin |
limit | String | No | Default is 50, maximum is 200. If setting exceeds 200, an error will be reported |
after | String | No | The whole minute timestamp is 13 digits (milliseconds). Query the coin price less than this time |
before | String | No | The whole minute timestamp is 13 digits (milliseconds). Query the coin price greater than this time. When neither before nor after is passed, by default, after is used as the current time |
period | String | No | 1m 1 minute 5m 5 minutes 30m 30 minutes 1h 1 hour 1d 1 day (default) |
Parameter | Type | Description |
---|---|---|
time | String | Minute timestamp (whole minute) |
price | String | Coin price (precision 18 digits) |
curl --location --request GET 'https://www.okx.com/api/v5/waas/coin/historical-price?chainId=1&limit=5&after=1700040600000&period=5m' \
--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'
{
"code": 0,
"msg": "success",
"data": [
{
"time": "1700040600000",
"price": "1994.430000000000000000"
},
{
"time": "1700040300000",
"price": "1994.190000000000000000"
},
{
"time": "1700040000000",
"price": "1992.090000000000000000"
},
{
"time": "1700039700000",
"price": "1992.190000000000000000"
},
{
"time": "1700039400000",
"price": "1990.190000000000000000"
}
]
}