Wallet API
Get historical coin price

Get historical coin price#

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.

Request address#

GET https://www.okx.com/api/v5/waas/coin/historical-price

Request parameters#

chainIdStringYesUnique identifier of the chain
tokenAddressStringNoIf not passed, query the mainnet coin
limitStringNoDefault is 50, maximum is 200.
If setting exceeds 200, an error will be reported
afterStringNoThe whole minute timestamp is 13 digits (milliseconds). Query the coin price less than this time
beforeStringNoThe 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
periodStringNo1m 1 minute
5m 5 minutes
30m 30 minutes
1h 1 hour
1d 1 day (default)

Response parameters#

timeStringMinute timestamp (whole minute)
priceStringCoin price (precision 18 digits)

Request example#

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'

Response example#

  "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"