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

# Historical Valuation

> Retrieve daily or monthly historical price-to-earnings (`PE`) values.

## Plan Access

| Plan | Available |
| - | :-: |
| Free | ❌ |
| Starter | ❌ |
| Professional | ✅ |
| Full-Market Plans (A-Shares, HK Stocks, US Stocks) | ✅ |
| Enterprise | ✅ |

## Notes

* Each element in `points` is `[time, metric value]`, not an object with named fields. The time is an RFC 3339 string with a time-zone offset.
* Without a date range, `daily` defaults to the past year and `monthly` to the past five years. If no records match, the endpoint returns HTTP 404 with code `40405`, not a successful empty array.

## Supported Markets

| Market | Examples |
| - | - |
| US Stocks | AAPL.US |
| HK Stocks | 700.HK |
| A-Shares | 600519.SH |

## Request Parameters

| Parameter | Required | Description |
| - | :-: | - |
| `symbol` | Yes | Stock symbol |
| `type` | No | Product type; currently supports `stock` |
| `granularity` | No | `daily` or `monthly`; default `daily` |
| `from` | No | Start date in `YYYY-MM-DD` format |
| `to` | No | End date in `YYYY-MM-DD` format |

## Request Example

```bash theme={null}
curl -H "X-API-Key: YOUR_API_KEY" \
  "https://api.tickdb.ai/v1/fundamentals/valuation/ts?symbol=AAPL&type=stock&granularity=monthly"
```

## Response Fields

The table below lists fields in `data`; an outer `code=0` indicates success.

| Field | Description |
| - | - |
| symbol | Stock symbol. |
| metric | Valuation metric; currently `PE` (price-to-earnings ratio). |
| granularity | Daily or monthly time granularity. |
| from | Query range start date in `YYYY-MM-DD` format. |
| to | Query range end date in `YYYY-MM-DD` format. |
| points | Historical valuation records, each represented as `[time, metric value]`. |
| └─ \[0] | RFC 3339 date-time string with a time-zone offset. |
| └─ \[1] | Metric value as a string, number, or `null`. |

Returns daily or monthly historical `PE` values over the queried date range.


## OpenAPI

````yaml openapi.en.yaml GET /v1/fundamentals/valuation/ts
openapi: 3.1.0
info:
  title: TickDB API
  description: TickDB unified real-time market data API via REST and WebSocket.
  version: 1.0.3
  contact:
    email: support@tickdb.ai
servers:
  - url: https://api.tickdb.ai
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /v1/fundamentals/valuation/ts:
    get:
      tags:
        - fundamentals-valuation-industry
      summary: Historical Valuation
      description: Retrieve daily or monthly historical price-to-earnings (`PE`) values.
      operationId: getFundamentalsValuationTimeSeries
      parameters:
        - $ref: '#/components/parameters/SymbolQuery'
        - $ref: '#/components/parameters/TypeQuery'
        - $ref: '#/components/parameters/GranularityQuery'
        - $ref: '#/components/parameters/ValuationFromQuery'
        - $ref: '#/components/parameters/ValuationToQuery'
      responses:
        '200':
          $ref: '#/components/responses/ValuationTimeSeriesResponse'
        default:
          $ref: '#/components/responses/ErrorResponse'
components:
  parameters:
    SymbolQuery:
      name: symbol
      in: query
      required: true
      schema:
        type: string
        examples:
          - AAPL
          - '700'
          - '600519'
          - AAPL.US
          - 700.HK
          - 600519.SH
      description: Stock symbol
    TypeQuery:
      name: type
      in: query
      required: false
      schema:
        type: string
        enum:
          - stock
      description: Product type; currently supports `stock`
    GranularityQuery:
      name: granularity
      in: query
      required: false
      schema:
        type: string
        enum:
          - daily
          - monthly
        default: daily
      description: '`daily` or `monthly`; default `daily`'
    ValuationFromQuery:
      name: from
      in: query
      required: false
      schema:
        type: string
        format: date
      description: Start date in `YYYY-MM-DD` format
    ValuationToQuery:
      name: to
      in: query
      required: false
      schema:
        type: string
        format: date
      description: End date in `YYYY-MM-DD` format
  responses:
    ValuationTimeSeriesResponse:
      description: Historical Valuation response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValuationTimeSeriesEnvelope'
    ErrorResponse:
      description: >-
        Error response. Common HTTP statuses include 400 (invalid parameters),
        401 (authentication failed), 403 (permission or quota restriction), 404
        (no matching data), 429 (rate limit), and 503 (service temporarily
        unavailable).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            missingAPIKey:
              summary: Missing API key
              value:
                code: '1002'
                message: API key is required. Provide via X-API-Key header
                error: '1002'
            missingKind:
              summary: Missing required parameter
              value:
                code: 40001
                message: kind is required
                data: null
            endpointForbidden:
              summary: API key cannot access this endpoint
              value:
                code: 3009
                message: This endpoint is not allowed for your API key
                data: null
            marketForbidden:
              summary: API key cannot access this market
              value:
                code: 3010
                message: Fundamentals market not allowed for your API key
                data:
                  market: US
            noAvailableSource:
              summary: Data temporarily unavailable
              value:
                code: 5003
                message: Data is temporarily unavailable
                data: null
            notFound:
              summary: No matching data
              value:
                code: 40404
                message: shareholder detail not found
                data: null
            businessNoData:
              summary: No business data matches the query
              value:
                code: 40405
                message: valuation time series not found
                data: null
  schemas:
    ValuationTimeSeriesEnvelope:
      allOf:
        - $ref: '#/components/schemas/SuccessEnvelope'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/ValuationTimeSeriesData'
    ErrorEnvelope:
      type: object
      required:
        - code
        - message
      properties:
        code:
          description: >-
            TickDB API business error code; may be an integer or string. Convert
            it to a string before comparing.
          oneOf:
            - type: integer
            - type: string
        message:
          type: string
          description: Error description.
        error:
          type: string
          description: >-
            Compatibility error identifier; present only in some error
            responses.
        data:
          description: Optional error context; may be null, an object, or an array.
          oneOf:
            - type: 'null'
            - type: object
              additionalProperties: true
            - type: array
              items: {}
    SuccessEnvelope:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: integer
          const: 0
          description: Business status code; `0` means success.
    ValuationTimeSeriesData:
      type: object
      required:
        - symbol
        - metric
        - granularity
        - from
        - to
        - points
      properties:
        symbol:
          type: string
          description: Stock symbol.
        metric:
          type: string
          enum:
            - PE
          description: Valuation metric; currently `PE` (price-to-earnings ratio).
        granularity:
          type: string
          enum:
            - daily
            - monthly
          description: Daily or monthly time granularity.
        from:
          type: string
          format: date
          description: Query range start date in `YYYY-MM-DD` format.
        to:
          type: string
          format: date
          description: Query range end date in `YYYY-MM-DD` format.
        points:
          type: array
          description: >-
            Historical valuation records, each represented as `[time, metric
            value]`.
          items:
            $ref: '#/components/schemas/MetricPoint'
      additionalProperties: true
    MetricPoint:
      type: array
      minItems: 2
      maxItems: 2
      prefixItems:
        - type: string
          format: date-time
          description: RFC 3339 date-time string with time zone information.
        - type:
            - string
            - number
            - 'null'
          description: Metric value.
      items: false
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````

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