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

# Get market stats history

> Handles `GET /v1/market/{symbol}/stats` via `get.v1.market.by_symbol.stats`.



## OpenAPI

````yaml /openapi/phoenix-public-api.json get /v1/market/{symbol}/stats
openapi: 3.1.0
info:
  title: Phoenix Eternal API
  description: >-
    RESTful API for accessing Phoenix Eternal perpetual trading data. Provides
    real-time orderbook levels, asset information, and market metadata.
  termsOfService: https://www.phoenix.trade/terms-of-service
  contact:
    name: Phoenix Development Team
    url: https://github.com/Ellipsis-Labs/phoenix
  license:
    name: Proprietary
  version: 1.0.0
servers:
  - url: https://perp-api.phoenix.trade
    description: Phoenix Eternal Perp API
security: []
tags:
  - name: Auth
    description: Wallet and session authentication.
  - name: Exchange
    description: Exchange, market, candle, and no-referral register-instruction workflows.
  - name: Invite
    description: Invite validation, referral activation, and wallet allowlist checks.
  - name: Notifications
    description: Trader notification reads and acknowledgement helpers.
  - name: Trader
    description: Trader state, account history, and transaction builders.
externalDocs:
  url: https://docs.phoenix.trade
  description: Phoenix developer documentation
paths:
  /v1/market/{symbol}/stats:
    get:
      tags:
        - Exchange
      summary: Get market stats history
      description: >-
        Handles `GET /v1/market/{symbol}/stats` via
        `get.v1.market.by_symbol.stats`.
      operationId: get.v1.market.by_symbol.stats
      parameters:
        - name: symbol
          in: path
          description: Market symbol
          required: true
          schema:
            type: string
          example: SOL-PERP
        - name: start_time
          in: query
          description: Start time for market stats history (defaults to 1 hour ago)
          required: false
          schema:
            type:
              - string
              - 'null'
            format: date-time
          example: '2025-05-29T19:20:00.000Z'
        - name: end_time
          in: query
          description: End time for market stats history (defaults to now)
          required: false
          schema:
            type:
              - string
              - 'null'
            format: date-time
          example: '2025-05-29T19:25:00.000Z'
        - name: limit
          in: query
          description: Maximum number of data points to return (max 10000, default 1000)
          required: false
          schema:
            type:
              - integer
              - 'null'
            format: int64
          example: 1000
        - name: timeframe
          in: query
          description: >-
            Timeframe for aggregating stats (1s, 5s, 1m, 5m, 15m, 30m, 1h, 4h,
            1d)
          required: false
          schema:
            type:
              - string
              - 'null'
          example: 1h
      responses:
        '200':
          description: Successfully retrieved market stats history
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketStatsHistoryResponse'
        '400':
          $ref: '#/components/responses/ErrorResponse'
        '404':
          $ref: '#/components/responses/ErrorResponse'
        '500':
          $ref: '#/components/responses/ErrorResponse'
      security:
        - PhoenixBearerAuth: []
components:
  schemas:
    MarketStatsHistoryResponse:
      type: object
      description: Response for market stats history endpoint
      required:
        - market_id
        - symbol
        - stats
      properties:
        market_id:
          type: integer
          format: int64
        stats:
          type: array
          items:
            $ref: '#/components/schemas/MarketStatsPoint'
        symbol:
          type: string
        timeframe:
          type:
            - string
            - 'null'
    MarketStatsPoint:
      type: object
      description: Individual market stats data point
      required:
        - open_interest
        - mark_price
        - spot_price
        - timestamp
        - slot
      properties:
        mark_price:
          type: number
          format: double
        open_interest:
          type: number
          format: double
        slot:
          type: integer
          format: int64
        spot_price:
          type: number
          format: double
        timestamp:
          type: string
          format: date-time
          description: Formatted datetime string (ISO 8601).
        total_maker_fees:
          type:
            - number
            - 'null'
          format: double
        total_taker_fees:
          type:
            - number
            - 'null'
          format: double
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
  responses:
    ErrorResponse:
      description: Standard JSON error payload.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    PhoenixBearerAuth:
      type: http
      scheme: bearer
      description: Bearer access token issued by `/v1/auth/*` login endpoints.

````