> ## Documentation Index
> Fetch the complete documentation index at: https://pmxt.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch Historical Prices

> Returns historical price data as tickers within a time range.



## OpenAPI

````yaml /api-reference/openapi.json get /api/feeds/{feed}/fetchHistoricalPrices
openapi: 3.0.0
info:
  title: PMXT Hosted API
  description: >-
    One API for supported prediction markets. Hosted catalog search in under
    10ms, a unified schema for supported venues, and venue-native trading where
    venues expose writes.
  version: 2.54.0
servers:
  - url: https://api.pmxt.dev
    description: Hosted PMXT (production)
security: []
tags:
  - name: Hosted
    description: >-
      Requires a PMXT API key. These endpoints use the cross-venue catalog and
      have no local equivalent.
  - name: Local Only
    description: >-
      Executed locally by the SDK against the venue. Never proxied through PMXT
      servers.
  - name: Data Feeds
    description: >-
      Auxiliary price and oracle data feeds (Binance, Chainlink).
      CCXT-compatible method names and response shapes.
paths:
  /api/feeds/{feed}/fetchHistoricalPrices:
    get:
      tags:
        - Data Feeds
      summary: Fetch Historical Prices
      description: Returns historical price data as tickers within a time range.
      operationId: feedFetchHistoricalPrices
      parameters:
        - in: path
          name: feed
          schema:
            type: string
            enum:
              - binance
              - chainlink
          required: true
          description: The data feed provider.
        - in: query
          name: symbol
          required: true
          schema:
            type: string
          description: Trading pair (e.g. BTC/USD)
        - in: query
          name: fromTimestamp
          required: false
          schema:
            type: integer
          description: Start unix timestamp (seconds)
        - in: query
          name: untilTimestamp
          required: false
          schema:
            type: integer
          description: End unix timestamp (seconds)
        - in: query
          name: maxSize
          required: false
          schema:
            type: integer
          description: Max records to return
        - in: query
          name: order
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
          description: Sort order
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/FeedTicker'
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: python
          label: Python
          source: >-
            from pmxt.feed_client import FeedClient


            feed = FeedClient("chainlink", pmxt_api_key="YOUR_PMXT_API_KEY")

            prices = feed.fetch_historical_prices("BTC/USD", max_size=20,
            order="desc")

            for p in prices:
                print(f"{p.datetime}: ${p.last}")
        - lang: javascript
          label: TypeScript
          source: >-
            import { FeedClient } from "pmxtjs";


            const feed = new FeedClient("chainlink", { pmxtApiKey:
            "YOUR_PMXT_API_KEY" });

            const prices = await feed.fetchHistoricalPrices("BTC/USD", {
              maxSize: 20,
              order: "desc",
            });

            for (const p of prices) {
              console.log(`${p.datetime}: $${p.last}`);
            }
components:
  schemas:
    FeedTicker:
      type: object
      description: CCXT-compatible ticker with last trade price and metadata.
      properties:
        symbol:
          type: string
          description: Trading pair symbol (e.g. BTC/USD)
        info:
          description: Raw provider-specific data
        timestamp:
          type: integer
          description: Unix timestamp in milliseconds
        datetime:
          type: string
          format: date-time
        high:
          type: number
        low:
          type: number
        bid:
          type: number
        bidVolume:
          type: number
        ask:
          type: number
        askVolume:
          type: number
        vwap:
          type: number
        open:
          type: number
        close:
          type: number
        last:
          type: number
          description: Last trade price
        previousClose:
          type: number
        change:
          type: number
        percentage:
          type: number
        average:
          type: number
        quoteVolume:
          type: number
        baseVolume:
          type: number
        indexPrice:
          type: number
        markPrice:
          type: number
      required:
        - symbol
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Required when calling the hosted API directly (curl, requests, fetch).
        SDK users pass credentials via constructor params instead.

````