openapi: 3.1.0
info:
  title: StashGamma EOD Stock Data API
  description: >
    Daily end-of-day OHLCV bars for U.S.-listed stocks, going back 15 years.
    Paste this schema into a ChatGPT Custom GPT's "Actions" editor (GPT
    Builder → Configure → Actions → Create new action → paste this schema),
    then set Authentication to "API Key", Auth Type "Custom", header name
    X-Api-Key, and your key value. See
    https://www.stashgamma.com/mcp-stock-data-api for the full walkthrough.
  version: "1.0.0"
servers:
  - url: https://www.stashgamma.com/api/dataapi/v1
paths:
  /eod/{symbol}:
    get:
      operationId: getEodData
      summary: Get daily OHLCV bars for a U.S.-listed stock symbol
      parameters:
        - name: symbol
          in: path
          required: true
          schema:
            type: string
          description: Ticker symbol, e.g. QQQ (case-insensitive)
        - name: from
          in: query
          required: false
          schema:
            type: string
            format: date
          description: Start date, YYYY-MM-DD. Defaults to 30 days before `to`.
        - name: to
          in: query
          required: false
          schema:
            type: string
            format: date
          description: End date, YYYY-MM-DD. Defaults to today.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  symbol:
                    type: string
                  from:
                    type: string
                  to:
                    type: string
                  count:
                    type: integer
                  bars:
                    type: array
                    items:
                      type: object
                      properties:
                        date:
                          type: string
                        open:
                          type: number
                        high:
                          type: number
                        low:
                          type: number
                        close:
                          type: number
                        volume:
                          type: integer
        '400':
          description: Bad request — malformed or inverted from/to date range
        '401':
          description: Missing, invalid, expired, or revoked API key
        '404':
          description: No EOD data for that symbol
        '429':
          description: Rate limit exceeded for your plan (see Retry-After header)
security:
  - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
