> ## 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.

# 同行估值對比

> 查詢與該股票同行的公司及其估值、每股收益等可比指標。

## 套餐權限

| 套餐 | 可用 |
| - | :-: |
| 免費版 | ❌ |
| 基礎版 | ❌ |
| 專業版 | ✅ |
| 全量套餐（A 股、港股、美股） | ✅ |
| 企業版 | ✅ |

## 注意事項

* 同業樣本和指標可用性隨市場、公司而變化；財務比率通常以字符串返回。

## 支持的市場

| 市場 | 示例 |
| - | - |
| 美股 | AAPL.US |
| 港股 | 700.HK |
| A股 | 600519.SH |

## 請求參數

| 參數 | 是否必須 | 說明 |
| - | :-: | - |
| `symbol` | 是 | 股票代碼 |
| `type` | 否 | 產品類型，當前支持 `stock` |

## 請求示例

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

## 返回字段說明

以下列出 `data` 中的字段；外層 `code=0` 表示成功。

| 字段 | 說明 |
| - | - |
| parent\_symbol | 被查詢股票代碼。 |
| peers | 可用於橫向比較的同行公司及指標列表。 |
| └─ peer\_symbol | 同行公司股票代碼。 |
| └─ peer\_name | 同行公司名稱。 |
| └─ currency | 指標幣種。 |
| └─ pe | 市盈率。 |
| └─ eps | 每股收益。 |
| └─ bps | 每股凈資產。 |
| └─ assets | 資產指標。 |
| └─ dps | 每股股息。 |
| └─ div\_yield | 股息率。 |
| └─ div\_payout\_ratio | 派息率。 |
| └─ five\_y\_avg\_dps | 五年平均每股股息。 |

返回同行公司的估值、每股收益、每股凈資產和股息等指標，便于橫向比較。


## OpenAPI

````yaml openapi.zh-Hant.yaml GET /v1/fundamentals/industry/peers
openapi: 3.1.0
info:
  title: TickDB API
  description: TickDB 統一即時行情數據 API，提供 REST 和 WebSocket 接入。
  version: 1.0.3
  contact:
    email: support@tickdb.ai
servers:
  - url: https://api.tickdb.ai
    description: 正式環境
security:
  - ApiKeyAuth: []
paths:
  /v1/fundamentals/industry/peers:
    get:
      tags:
        - fundamentals-valuation-industry
      summary: 同行估值對比
      description: 查詢與該股票同行的公司及其估值、每股收益等可比指標。
      operationId: getFundamentalsIndustryPeers
      parameters:
        - $ref: '#/components/parameters/SymbolQuery'
        - $ref: '#/components/parameters/TypeQuery'
      responses:
        '200':
          $ref: '#/components/responses/IndustryPeersResponse'
        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: 股票代碼
    TypeQuery:
      name: type
      in: query
      required: false
      schema:
        type: string
        enum:
          - stock
      description: 產品類型，當前支援 `stock`
  responses:
    IndustryPeersResponse:
      description: 同行估值對比回應。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/IndustryPeersEnvelope'
    ErrorResponse:
      description: >-
        錯誤回應。常見 HTTP 狀態包括
        400（參數錯誤）、401（驗證失敗）、403（權限或配額限制）、404（無符合條件的數據）、429（請求頻率限制）及 503（服務暫不可用）。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            missingAPIKey:
              summary: 缺少 API Key
              value:
                code: '1002'
                message: API key is required. Provide via X-API-Key header
                error: '1002'
            missingKind:
              summary: 缺少必填參數
              value:
                code: 40001
                message: kind is required
                data: null
            endpointForbidden:
              summary: API Key 無權存取此介面
              value:
                code: 3009
                message: This endpoint is not allowed for your API key
                data: null
            marketForbidden:
              summary: API Key 未開放該市場
              value:
                code: 3010
                message: Fundamentals market not allowed for your API key
                data:
                  market: US
            noAvailableSource:
              summary: 數據暫不可用
              value:
                code: 5003
                message: Data is temporarily unavailable
                data: null
            notFound:
              summary: 無符合條件的數據
              value:
                code: 40404
                message: shareholder detail not found
                data: null
            businessNoData:
              summary: 查詢條件沒有有效業務數據
              value:
                code: 40405
                message: valuation time series not found
                data: null
  schemas:
    IndustryPeersEnvelope:
      allOf:
        - $ref: '#/components/schemas/SuccessEnvelope'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/IndustryPeersData'
    ErrorEnvelope:
      type: object
      required:
        - code
        - message
      properties:
        code:
          description: TickDB API 業務錯誤碼；可能是整數或字串，客戶端應先轉為字串再比較。
          oneOf:
            - type: integer
            - type: string
        message:
          type: string
          description: 錯誤說明。
        error:
          type: string
          description: 相容錯誤標識；僅部分錯誤回應返回。
        data:
          description: 可選的錯誤上下文；可能是 null、物件或陣列。
          oneOf:
            - type: 'null'
            - type: object
              additionalProperties: true
            - type: array
              items: {}
    SuccessEnvelope:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: integer
          const: 0
          description: 業務狀態碼，成功為 `0`。
    IndustryPeersData:
      type: object
      required:
        - parent_symbol
        - peers
      properties:
        parent_symbol:
          type: string
          description: 被查詢股票代碼。
        peers:
          type: array
          description: 可用於橫向比較的同行公司及指標列表。
          items:
            $ref: '#/components/schemas/PeerItem'
      additionalProperties: true
    PeerItem:
      type: object
      required:
        - peer_symbol
        - peer_name
      properties:
        peer_symbol:
          type: string
          description: 同行公司股票代碼。
        peer_name:
          type: string
          description: 同行公司名稱。
        currency:
          type:
            - string
            - 'null'
          description: 指標幣種。
        assets:
          type:
            - string
            - number
            - 'null'
          description: 資產指標。
        bps:
          type:
            - string
            - number
            - 'null'
          description: 每股凈資產。
        eps:
          type:
            - string
            - number
            - 'null'
          description: 每股收益。
        dps:
          type:
            - string
            - number
            - 'null'
          description: 每股股息。
        div_yield:
          type:
            - string
            - number
            - 'null'
          description: 股息率。
        div_payout_ratio:
          type:
            - string
            - number
            - 'null'
          description: 派息率。
        five_y_avg_dps:
          type:
            - string
            - number
            - 'null'
          description: 五年平均每股股息。
        pe:
          type:
            - string
            - number
            - 'null'
          description: 市盈率。
      additionalProperties: true
  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.