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

# 訂單簿

> 獲取交易品種的實時盤口、實時訂單簿深度（買賣盤）數據。

## 注意事項

* 買盤（bids）按價格降序排列
* 賣盤（asks）按價格升序排列
* 時間戳單位為毫秒（UTC）

## 支持的市場

**美股**、**港股**、**A股**、**中國期貨**、**加密貨幣**

示例：

* 美股：AAPL.US、TSLA.US、MSFT.US
* 港股：700.HK、9988.HK、3690.HK
* A股：600519.SH、000001.SZ、920186.BJ
* 中國期貨：BU2609、IC2606、AP8888
* 加密貨幣：BTCUSDT、ETHUSDT、ADAUSDT

## 請求參數

| 參數名    | 是否必須 | 描述                                                                                                       |
| ------ | ---- | -------------------------------------------------------------------------------------------------------- |
| symbol | 是    | 交易產品代碼                                                                                                   |
| limit  | 否    | 深度檔位數，默認10，最大50                                                                                          |
| type   | 否    | 產品類型，可選。代碼無歧義時無需傳遞；若返回 `AMBIGUOUS_SYMBOL` 錯誤，按提示傳入對應值即可。可選值：`stock`、`indices`、`crypto`、`forex`、`futures` |

## 返回字段說明

| 字段        | 說明                   |
| --------- | -------------------- |
| symbol    | 交易產品                 |
| type      | 產品類型                 |
| timestamp | 數據時間戳（毫秒，UTC）        |
| bids      | 買盤數組，每個元素為 \[價格, 數量] |
| asks      | 賣盤數組，每個元素為 \[價格, 數量] |


## OpenAPI

````yaml GET /v1/market/depth
openapi: 3.0.0
info:
  title: TickDB API
  description: >-
    Unified real-time market data API — one connection for Forex, indices, US
    stocks, HK stocks, A-shares, China futures, and Crypto via REST and
    WebSocket.
  version: 1.0.2
  contact:
    email: support@tickdb.ai
servers:
  - url: https://api.tickdb.ai
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /v1/market/depth:
    get:
      summary: Order Book
      description: Get real-time order book bids and asks
      parameters:
        - name: symbol
          in: query
          required: true
          description: Trading symbol
          schema:
            type: string
            default: 700.HK
            example: 700.HK
        - name: limit
          in: query
          required: false
          description: Depth levels (default 10, max 50)
          schema:
            type: integer
            minimum: 1
            maximum: 50
            example: 20
        - name: type
          in: query
          required: false
          description: >-
            Symbol type, optional. Not required when the symbol is unambiguous;
            if the API returns an AMBIGUOUS_SYMBOL error, pass the value as
            indicated
          schema:
            type: string
            enum:
              - stock
              - indices
              - crypto
              - forex
              - futures
            example: stock
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 0
                  message:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      symbol:
                        type: string
                        example: 700.HK
                      type:
                        type: string
                        enum:
                          - stock
                          - indices
                          - crypto
                          - forex
                          - futures
                      timestamp:
                        type: integer
                        example: 1768274016162
                      bids:
                        type: array
                        description: Buy orders sorted by price descending
                        items:
                          type: array
                          items:
                            type: string
                        example:
                          - - '626'
                            - '19700'
                          - - '625.5'
                            - '40800'
                      asks:
                        type: array
                        description: Sell orders sorted by price ascending
                        items:
                          type: array
                          items:
                            type: string
                        example:
                          - - '626.5'
                            - '36100'
                          - - '627'
                            - '50700'
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````