Accessing accurate historical token price data is essential for developers, analysts, and investors building or evaluating blockchain-based applications. Whether you're tracking native cryptocurrencies, ERC-20 tokens, or emerging inscription standards like BRC-20 and Runes, having reliable, time-series pricing information empowers smarter decision-making across trading strategies, portfolio analysis, and Web3 application development.
The OKX Web3 API offers a powerful endpoint to retrieve granular historical price data for a wide range of digital assets across multiple chains. This guide explores how to use the Historical Token Price API, its supported token types, request parameters, response structure, and practical use cases โ all designed to enhance your on-chain data analysis and wallet-as-a-service (WaaS) integrations.
Supported Token Types
The API supports historical price queries for diverse token standards, making it one of the most comprehensive tools for cross-chain and on-chain data retrieval:
- Native tokens: Retrieve price history for base assets like BTC, ETH, or OKT.
- Standard tokens: Supports ERC-20, BEP-20, and other smart contract-based tokens.
Bitcoin inscription tokens:
- BRC-20 on Bitcoin mainnet
- Runes protocol tokens
- ARC-20 and SRC-20 tokens
Fractal Bitcoin chain inscriptions:
- FBRC-20 tokens on the Fractal Bitcoin network
This breadth ensures developers can analyze both traditional and emerging asset classes within a unified framework.
๐ Discover real-time and historical pricing for BRC-20 and Runes tokens with advanced API access.
How to Query Historical Prices
To fetch historical token prices, send a GET request to the following endpoint:
https://web3.okx.com/api/v5/wallet/token/historical-price
This RESTful API is designed for simplicity and scalability, supporting pagination, time filtering, and customizable intervals.
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
chainIndex | String | Yes | Unique identifier for the blockchain (e.g., btc , eth ). |
tokenAddress | String | No | Token address format varies by type: - Empty string ( "" ) for native tokens- Contract address for standard tokens - Special formats for inscriptions: โโข BRC-20: btc-brc20-ordi โโข Runes: btc-runesMain-840000:2 โโข SRC-20: btc-src20-utxo โโข FBRC-20: fbtc_fbrc20_babymusk |
limit | String | No | Number of records per page (default: 50, max: 200). |
cursor | String | No | Pagination cursor; defaults to first page. |
begin | String | No | Start timestamp in milliseconds (Unix epoch). |
end | String | No | End timestamp in milliseconds. If not provided, defaults to current time. |
period | String | No | Time interval: 1m , 5m , 30m , 1h , or 1d (default). |
Example Request
GET https://web3.okx.com/api/v5/wallet/token/historical-price?
chainIndex=btc&
tokenAddress=btc-brc20-ordi&
period=1h&
limit=100&
begin=1672531200000&
end=1675123200000
This retrieves hourly price data for the ORDI BRC-20 token over a one-month period in early 2023.
Understanding the Response
The API returns structured JSON with timestamped price points.
Response Parameters
prices (Array): List of historical price entries
- time (String): Timestamp in UTC, rounded to the nearest minute
- price (String): Price value with up to 18 decimal places precision
Example Response
{
"prices": [
{ "time": "1672531200", "price": "45.6789" },
{ "time": "1672534800", "price": "46.1234" },
{ "time": "1672538400", "price": "47.0011" }
]
}
Each entry represents the opening price for the specified time interval (e.g., hourly). The high precision allows for accurate financial modeling and analytics.
๐ Get structured on-chain pricing data for Runes and BRC-20 tokens with minimal latency.
Practical Use Cases
1. Portfolio Performance Analysis
Developers building crypto portfolio trackers can pull daily price histories for both native coins and niche inscription tokens to calculate gains, losses, and asset allocation trends over time.
2. Market Research & Trend Identification
Analysts can compare price movements between different inscription standards (e.g., BRC-20 vs. Runes) to identify market sentiment shifts and adoption patterns on Bitcoin-based ecosystems.
3. Algorithmic Trading Bots
By integrating minute-level (1m
, 5m
) data, traders can design technical indicators and execute automated strategies based on precise historical behavior.
4. Wallet-as-a-Service (WaaS) Platforms
WaaS providers can enrich user experiences by displaying historical balance valuations in fiat or stablecoins, powered by accurate time-series pricing.
5. NFT and Inscription Marketplaces
Platforms listing BRC-20 or FBRC-20 tokens can show price charts and volatility metrics to improve buyer confidence and transparency.
Core Keywords
This guide focuses on the following SEO-optimized keywords to align with user search intent:
- historical token price
- on-chain information query
- Web3 API
- wallet API
- BRC-20 price data
- Runes token price
- inscription token pricing
- blockchain price history
These terms are naturally integrated throughout the content to support discoverability without compromising readability.
Frequently Asked Questions
Q: Can I query historical prices for native Bitcoin (BTC) using this API?
A: Yes. Simply set chainIndex=btc
and leave tokenAddress
as an empty string (""
) to retrieve BTCโs historical price.
Q: What is the maximum time range I can query at once?
A: There is no fixed limit on time range, but each request returns a maximum of 200 data points. Use pagination with the cursor
parameter for longer histories.
Q: Are prices adjusted for splits or token migrations?
A: The API reflects actual on-chain market prices. For tokens that have undergone migrations or rebrandings, ensure you're querying the correct tokenAddress
format for the relevant period.
Q: How frequently is the data updated?
A: Data is updated in near real-time. For 1m
and 5m
intervals, new candles are available shortly after each period closes.
Q: Is there rate limiting on this API?
A: Yes. To ensure fair usage, rate limits apply based on your API key tier. Refer to OKXโs official documentation for specific thresholds.
Q: Can I use this API for commercial applications?
A: Absolutely. The Web3 API is designed for integration into commercial platforms, including analytics dashboards, wallets, and trading systems.
๐ Start integrating high-frequency historical token price data into your Web3 app today.