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

# Metrics Historical

> Returns time-series market metrics (OHLCV, liquidity, open interest) at configurable intervals.



## OpenAPI

````yaml GET /v1/api/metrics/historical
openapi: 3.1.0
info:
  title: Dot Prediction API
  description: >-
    A unified API for accessing prediction market data across Kalshi,
    Polymarket, and Limitless.
  version: 1.0.0
servers:
  - url: https://api.dotprediction.io
security:
  - apiKey: []
paths:
  /v1/api/metrics/historical:
    get:
      tags:
        - Metrics
      summary: Metrics historical
      description: >-
        Returns time-series market metrics (OHLCV, liquidity, open interest) at
        configurable intervals.
      operationId: getMetricsHistorical
      parameters:
        - name: platform
          in: query
          required: true
          description: The platform to query.
          schema:
            type: string
            enum:
              - kalshi
              - polymarket
              - limitless
        - name: market_id
          in: query
          required: true
          description: The market ID.
          schema:
            type: string
        - name: start_ts
          in: query
          required: true
          description: Start time as Unix timestamp.
          schema:
            type: integer
            format: int64
        - name: end_ts
          in: query
          required: true
          description: End time as Unix timestamp.
          schema:
            type: integer
            format: int64
        - name: interval
          in: query
          required: false
          description: Candle interval.
          schema:
            type: string
            enum:
              - 1m
              - 5m
              - 15m
              - 1h
              - 4h
              - 1d
            default: 1d
        - name: limit
          in: query
          required: false
          description: Max results to return (default 1000, max 5000).
          schema:
            type: integer
            default: 1000
            maximum: 5000
      responses:
        '200':
          description: Historical market metrics.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketMetricsHistoricalResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: 0d5813fe-a3df-4eee-bda5-8e01bfe0683a
        '500':
          $ref: 13256dda-f2cf-48d5-853d-eda20215fa08
components:
  schemas:
    MarketMetricsHistoricalResponse:
      type: object
      properties:
        market_id:
          type: string
        platform:
          type: string
        interval:
          type: string
        data:
          type: array
          items:
            $ref: '#/components/schemas/MetricsCandle'
        data_availability:
          type: object
          properties:
            price:
              type: boolean
            volume:
              type: boolean
            open_interest:
              type: boolean
            liquidity:
              type: boolean
            trade_count:
              type: boolean
            notional_value:
              type: boolean
        meta:
          type: object
          properties:
            platforms:
              type: array
              items:
                type: string
            time_range:
              type: object
              properties:
                start:
                  type: integer
                  format: int64
                end:
                  type: integer
                  format: int64
            interval:
              type: string
            total_candles:
              type: integer
            request_time:
              type: integer
            cache_hit:
              type: boolean
            data_freshness:
              type: string
    MetricsCandle:
      type: object
      properties:
        timestamp:
          type: integer
          format: int64
        price:
          type: object
          properties:
            open:
              type: number
            high:
              type: number
            low:
              type: number
            close:
              type: number
        volume:
          type: number
        open_interest:
          type: number
        liquidity:
          type: object
          properties:
            best_bid:
              type: number
            best_ask:
              type: number
            spread:
              type: number
            midpoint:
              type: number
        trade_count:
          type: integer
        notional_value:
          type: number
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
            message:
              type: string
              description: Human-readable error message.
            resolution:
              type: string
              description: Suggested action to resolve the error.
            error_text:
              type: string
              description: Detailed error information.
  responses:
    BadRequest:
      description: Invalid request parameters.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key for authentication. Generate one via the dashboard or the
        `/v1/api/auth/api-keys` endpoint.

````