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

# Get Historical



## OpenAPI

````yaml /openapi.json get /stocks/{symbol}/historical
openapi: 3.1.0
info:
  title: psxdata
  version: 0.8.0
servers:
  - url: https://psxdata-api.fastapicloud.dev
security: []
paths:
  /stocks/{symbol}/historical:
    get:
      tags:
        - stocks
      summary: Get Historical
      operationId: get_historical_stocks__symbol__historical_get
      parameters:
        - name: symbol
          in: path
          required: true
          schema:
            type: string
            title: Symbol
        - name: start
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Start
        - name: end
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: End
        - name: X-PSX-Proxy
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Optional proxy for this request's PSX traffic: http://, socks5://
              or socks5h://, with an explicit port and optional user:pass@. Must
              resolve to a public address. Cached data is served without
              contacting the proxy; it is used only when PSX must be fetched,
              with stricter rate limits. Only honoured when the server enables
              proxy passthrough.
            title: X-Psx-Proxy
          description: >-
            Optional proxy for this request's PSX traffic: http://, socks5:// or
            socks5h://, with an explicit port and optional user:pass@. Must
            resolve to a public address. Cached data is served without
            contacting the proxy; it is used only when PSX must be fetched, with
            stricter rate limits. Only honoured when the server enables proxy
            passthrough.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HistoricalResponse'
          headers:
            X-Cache:
              description: >-
                HIT (fresh cache), MISS (fetched from PSX), or STALE (PSX
                refused or was unreachable; last cached copy served)
              schema:
                type: string
                enum:
                  - HIT
                  - MISS
                  - STALE
            Age:
              description: Seconds since the data was fetched from PSX (HIT and STALE only)
              schema:
                type: integer
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '503':
          description: PSX is unavailable or rate-limiting, and no cached copy exists
          headers:
            Retry-After:
              description: Seconds to wait before retrying (sent when PSX is rate-limiting)
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
components:
  schemas:
    HistoricalResponse:
      properties:
        data:
          items:
            $ref: '#/components/schemas/OHLCVRow'
          type: array
          title: Data
        meta:
          $ref: '#/components/schemas/MetaList'
      type: object
      required:
        - data
        - meta
      title: HistoricalResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      type: object
      required:
        - error
      title: ErrorEnvelope
      description: Top-level error response wrapper.
    OHLCVRow:
      properties:
        date:
          type: string
          title: Date
        open:
          type: number
          title: Open
        high:
          type: number
          title: High
        low:
          type: number
          title: Low
        close:
          type: number
          title: Close
        volume:
          type: integer
          title: Volume
        is_anomaly:
          type: boolean
          title: Is Anomaly
      type: object
      required:
        - date
        - open
        - high
        - low
        - close
        - volume
        - is_anomaly
      title: OHLCVRow
    MetaList:
      properties:
        timestamp:
          type: string
          title: Timestamp
        cached:
          type: boolean
          title: Cached
        count:
          type: integer
          title: Count
      type: object
      required:
        - timestamp
        - cached
        - count
      title: MetaList
      description: Metadata block for list responses. Always includes count.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ErrorDetail:
      properties:
        status:
          type: integer
          title: Status
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
      type: object
      required:
        - status
        - code
        - message
      title: ErrorDetail
      description: Structured error payload.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.