Historical Crypto Prices and On-Chain Data via Web3 API

·

Accessing accurate historical cryptocurrency prices is essential for developers, analysts, and blockchain enthusiasts building data-driven applications in the decentralized space. Whether you're tracking the performance of major cryptocurrencies or exploring price trends of emerging token standards like BRC-20 and Runes, reliable and granular data access can significantly enhance your project’s analytical depth and user experience.

The OKX Web3 API provides a powerful endpoint to retrieve historical price data across multiple chains and token types. This guide explores how to use the Historical Price API, its supported assets, request structure, response format, and practical use cases — all optimized for developers integrating on-chain insights into wallets, analytics dashboards, or DeFi platforms.

Supported Chains and Token Types

The Historical Price API supports a wide range of digital assets across different blockchain ecosystems:

This broad support enables developers to analyze both traditional crypto assets and newer inscription-based tokens that are gaining traction in the Web3 ecosystem.

👉 Discover real-time and historical pricing for all major token standards with powerful Web3 tools.

API Endpoint Overview

To retrieve historical price data, use the following RESTful GET request:

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

This endpoint returns time-series price data in USD with high precision (18 decimal places), making it suitable for financial modeling, backtesting strategies, or visualizing market trends.

Request Parameters

Customize your query using the following optional and required parameters:

ParameterTypeRequiredDescription
chainIndexStringYesUnique identifier for the blockchain (e.g., "btc" for Bitcoin).
tokenAddressStringNo- Leave empty ("") to query the native coin of the chain.
- Provide a contract address for ERC-20 or similar tokens.
- For inscription tokens, use specific naming formats:
 • FBRC-20: fbtc_fbrc20_name, e.g., fbtc_fbrc20_babymusk
 • BRC-20: btc-brc20-tick(name), e.g., btc-brc20-ordi
 • Runes: btc-runesMain-tickId, e.g., btc-runesMain-840000:2
 • SRC-20: btc-src20-name, e.g., btc-src20-utxo
limitStringNoNumber of records per request. Default: 50; Maximum: 200.
cursorStringNoPagination cursor for retrieving subsequent pages. Defaults to first page.
beginStringNoStart time in Unix milliseconds. Returns prices after this timestamp.
endStringNoEnd time in Unix milliseconds. Returns prices before this timestamp. If neither begin nor end is provided, returns data up to the current time.
periodStringNoTime interval between data points:
1m, 5m, 30m, 1h, 1d (default).

These parameters allow fine-grained control over data granularity and time range, ideal for charting tools or batch processing workflows.

Response Structure

The API returns a JSON object containing the requested price data:

{
  "prices": [
    {
      "time": "1700006400000",
      "price": "43250.123456789012345678"
    },
    {
      "time": "1700006460000",
      "price": "43255.987654321098765432"
    }
  ],
  "cursor": "next-page-cursor-token"
}

Key fields:

This structure ensures compatibility with most data visualization libraries and backend systems requiring precise financial data.

Practical Use Cases

1. Building a Multi-Token Price Chart

Developers can use this API to power dynamic price charts supporting not only ETH or BTC but also niche assets like BRC-20 tokens. By setting period=1h and adjusting begin/end, you can render 7-day, 30-day, or custom-range graphs.

2. Portfolio Performance Analysis

Wallet applications can pull historical prices to calculate gains/losses over time. For example, querying daily prices (period=1d) for an ERC-20 token held over three months allows accurate ROI computation.

3. On-Chain Analytics Dashboards

Data platforms tracking Bitcoin inscriptions can integrate FBRC-20 and Runes price movements alongside trading volume and minting activity to provide holistic market insights.

👉 Explore advanced blockchain analytics with seamless API integration for real-time decision-making.

Frequently Asked Questions (FAQ)

Q: Can I get historical prices for non-EVM chains like Bitcoin?
A: Yes. The API supports Bitcoin-native token standards including BRC-20, Runes, SRC-20, and FBRC-20 on Fractal Bitcoin, allowing deep analysis beyond traditional smart contract platforms.

Q: What is the maximum amount of data I can retrieve per request?
A: You can fetch up to 200 data points per call using the limit parameter. For larger datasets, paginate using the returned cursor.

Q: Is the price data adjusted for splits or forks?
A: The API provides raw market prices based on trading activity and does not adjust for events like token splits or forks. Users should account for such events separately if needed.

Q: How often is new price data added?
A: Data is updated at the frequency defined by the period. For example, with period=1h, a new entry is added every hour based on market conditions.

Q: Can I use this API in commercial applications?
A: Yes, as long as usage complies with OKX's Web3 API terms of service. Always ensure proper rate limiting and caching to avoid excessive requests.

Q: Are there any rate limits on this endpoint?
A: While specific limits depend on your access tier, general best practices include caching responses and spacing out requests. Check official documentation for detailed throttling policies.

Final Thoughts

Access to clean, structured historical price data is foundational for any serious blockchain application. With support for native coins, EVM tokens, and innovative Bitcoin-based standards like Runes and BRC-20, the OKX Web3 Historical Price API empowers developers to build richer, more insightful user experiences.

Whether you're creating a wallet interface, DeFi analytics tool, or NFT marketplace, integrating this API ensures your platform delivers accurate and timely financial information.

👉 Start leveraging high-precision historical crypto pricing in your next Web3 project today.