Pyth Core upgrade July 31, 2026. Every Core user will need an API Key. Learn more →
Developer Hub

Use Historical Price Data (Benchmarks)

Learn how to query and verify historical Pyth price feeds

This guide explains how to integrate Pyth Benchmarks to access historical price data across applications. The Benchmarks API is available on all Pythnet chains.

Pyth Core upgrades on July 31, 2026

  • We recommend new integrations use the upgraded contract addresses.
  • Existing integrations using the current addresses will be automatically upgraded by the DAO on July 31, 2026. See the upgrade guide for details.

The Benchmarks endpoints stay at the same URLs after the upgrade, but from July 31, 2026 every request must include an Authorization: Bearer $PYTH_API_KEY header. Get a Pyth API Key on the billing page.

Benchmarks Terminology

Throughout this guide, Benchmarks refers to Pyth’s historical price data service.

Overview

Pyth Benchmarks lets you query historical prices at specific timestamps. Typical use cases include:

  • Contract settlement for derivatives such as options or futures
  • Backtesting trading strategies with historical data
  • Audit and compliance workflows that require price verification
  • Analytics to analyze market behavior over time

Benchmarks supports two complementary flows:

Retrieve data from the Benchmarks API or through the Hermes timestamp API. Two REST endpoints are available:

Interval Window

The interval parameter represents the number of seconds added to the provided timestamp. For example, with timestamp 1716400000 and interval 60, the API returns price updates from 1716400000 through 1716400060 (inclusive). The interval must not exceed 60 seconds.

After fetching price updates, pass the result to parsePriceFeedUpdates instead of updatePriceFeeds when interacting with the Pyth contract.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";

contract HistoricalPriceConsumer {
    IPyth public pyth;

    constructor(address _pyth) {
        pyth = IPyth(_pyth);
    }

    function settleWithHistoricalPrice(
        bytes[] calldata priceUpdate,
        uint256 priceId,
        uint256 minPublishTime,
        uint256 maxPublishTime,
    ) external {
        // The parsePriceFeedUpdates function requires a fee to be paid.
        // The fee is the same as the fee for the updatePriceFeeds function.
        uint fee = pyth.getUpdateFee(priceUpdate);
        PythStructs.Price memory price = pyth.parsePriceFeedUpdates{value: fee}(
            priceUpdate,
            priceId,
            minPublishTime,
            maxPublishTime,
        );

        // Use the historical price for settlement
        uint256 settlementPrice = uint256(price.price);
        // ... settlement logic
    }
}

The verification flow differs from real-time price updates in that it:

  • Calls parsePriceFeedUpdates instead of updatePriceFeeds
  • Provides the price feed ID to ensure the update matches the feed
  • Supplies minPublishTime and maxPublishTime to enforce the allowable timestamp window, reverting with PriceFeedNotFoundWithinRange when updates fall outside the range

Consult the API reference for additional implementation details.

Additional Resources

API Reference

TradingView Integration

Rate Limits

  • Benchmarks API inherits the same limits as the Hermes API

On this page