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

# Get Candlesticks

> Get Candlesticks.

Get Candlesticks through the DexBuilder PerpDEX REST API.


## OpenAPI

````yaml openapi/perpdex-en.yaml GET /dex_futures/{settle}/candlesticks
openapi: 3.0.3
info:
  title: DexBuilder PerpDEX API
  version: 1.0.0
  description: DexBuilder PerpDEX REST API。
servers:
  - url: https://api.dexbuilder.com/api/v1
    description: DexBuilder PerpDEX REST API
security:
  - DexBuilderKey: []
    DexBuilderTimestamp: []
    DexBuilderSignature: []
tags:
  - name: 行情
    description: 永續合約公開行情與市場資料
  - name: 風險資料
    description: 風險限額與市場強平資料
  - name: 帳戶
    description: 帳戶與費率
  - name: 持倉
    description: 持倉查詢與管理
  - name: 訂單
    description: 訂單、成交與批量交易
paths:
  /dex_futures/{settle}/candlesticks:
    get:
      tags:
        - 行情
      summary: 查詢永續合約 K 線
      description: 查詢指定合約的 K 線資料。單次最多回傳 2000 個資料點。
      operationId: listPerpCandlesticks
      parameters:
        - $ref: '#/components/parameters/Settle'
        - $ref: '#/components/parameters/ContractQueryRequired'
        - $ref: '#/components/parameters/From'
        - $ref: '#/components/parameters/To'
        - name: limit
          in: query
          required: false
          description: 回傳最近資料點數量
          schema:
            type: integer
        - name: interval
          in: query
          required: false
          description: K 線週期
          schema:
            type: string
            default: 5m
        - name: timezone
          in: query
          required: false
          description: 時區，例如 utc0、utc8
          schema:
            type: string
            default: utc0
      responses:
        '200':
          description: 查詢成功
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Candlestick'
      security: []
components:
  parameters:
    Settle:
      name: settle
      in: path
      required: true
      description: 結算幣種
      schema:
        type: string
        enum:
          - usdt
      example: usdt
    ContractQueryRequired:
      name: contract
      in: query
      required: true
      description: 永續合約
      schema:
        type: string
      example: BTC_USDT
    From:
      name: from
      in: query
      required: false
      description: 開始時間，Unix 秒
      schema:
        type: integer
        format: int64
    To:
      name: to
      in: query
      required: false
      description: 結束時間，Unix 秒
      schema:
        type: integer
        format: int64
  schemas:
    Candlestick:
      type: object
      properties:
        t:
          type: number
          format: double
          description: 時間戳
        v:
          type: string
          description: 成交量
        c:
          type: string
          description: 收盤價
        h:
          type: string
          description: 最高價
        l:
          type: string
          description: 最低價
        o:
          type: string
          description: 開盤價
        sum:
          type: string
          description: 成交額
      additionalProperties: true
  securitySchemes:
    DexBuilderKey:
      type: apiKey
      in: header
      name: KEY
      description: DexBuilder API Key
    DexBuilderTimestamp:
      type: apiKey
      in: header
      name: Timestamp
      description: Unix 時間戳（秒），與目前時間差不得超過 60 秒
    DexBuilderSignature:
      type: apiKey
      in: header
      name: SIGN
      description: 使用 API Secret 對簽名字串執行 HMAC-SHA512 後的十六進制簽名

````

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