Wallet API
Historical Coin Price

Historical Coin Price#

Query the historical prices of a specific cryptocurrency.

Request Path#

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

Request Parameters#

ParameterTypeRequiredDescription
chainIndexStringYesUnique identifier of the blockchain
tokenAddressStringNoIf not provided, query all tokens. Use "" to query the main chain coin.
limitStringNoNumber of entries per query, default is 50, maximum is 100
cursorStringNoCursor position, defaults to the first entry
beginStringNoStart time to query historical prices after. Unix timestamp in milliseconds
endStringNoEnd time to query historical prices before. If neither begin nor end is provided, query historical prices before the current time. Unix timestamp in milliseconds
periodStringNoTime interval unit:
1m: 1 minute
5m: 5 minutes
30m: 30 minutes
1h: 1 hour
1d: 1 day (default)

Response Parameters#

ParameterTypeDescription
pricesArrayList of historical prices
>timeStringTimestamp of the minute (whole minute)
>priceStringCryptocurrency price (precision 18 decimal places)

Request Example#

shell
curl --location --request GET 'https://www.okx.com/api/v5/waas/wallet/token/historical-price?chainIndex=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#

200
{
    "code": "0",
    "msg": "success",
    "data": [
        {
            "cursor": "31",
            "prices": [
                {
                    "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"
                }
            ]
        }
    ]
}