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

# Get OHLCV candles for a product

> Returns historical OHLCV candles for the given product, ordered oldest-first.

      **`timeframe` is the candle bucket size**, not a history length.
      The server picks an appropriate Coinbase Advanced Trade granularity
      and a sensible lookback per timeframe so the chart shows ~100–300 candles:

      | `timeframe` | Granularity (Advanced Trade) | Candles returned | Total span |
      | --- | --- | --- | --- |
      | `1m`  | ONE_MINUTE      | 240 | 4 hours    |
      | `5m`  | FIVE_MINUTE     | 288 | 24 hours   |
      | `15m` | FIFTEEN_MINUTE  | 192 | 2 days     |
      | `1h`  | ONE_HOUR        | 168 | 1 week     |
      | `4h`  | TWO_HOUR        | 144 | 12 days    |
      | `1d`  | ONE_DAY         | 90  | 3 months   |
      | `1w`  | ONE_DAY         | 180 | ~6 months  |
      | `1M`  | ONE_DAY         | 270 | ~9 months  |
      | `1Y`  | ONE_DAY         | 290 | ~10 months |

      Coinbase Advanced Trade caps a single response at ~300 candles and
      has no native `FOUR_HOUR` / weekly / monthly / yearly granularity.
      `4h` is approximated with `TWO_HOUR` candles, and the longer
      labels use daily candles with progressively wider lookbacks.

      The legacy `granularity` query param is accepted but ignored — the
      server derives it from `timeframe` to prevent the two from drifting.



## OpenAPI

````yaml /api-reference/openapi.json get /product/rates
openapi: 3.0.0
info:
  title: Xenios Trading API
  description: >-
    Place and manage orders, stream live market and account data, and read
    wallets, deposits and reference data over one authenticated gateway. All
    protected endpoints are authenticated with an HMAC-SHA256 request signature
    (see the Authentication guide). Decimal amounts are strings; timestamps are
    ISO-8601. Successful responses are wrapped in a standard { statusCode,
    success, message, data } envelope.
  version: '1.0'
  contact: {}
servers:
  - url: https://<your-host>/api/v1/trading
    description: Development gateway. Prefix every trading path with this base URL.
security:
  - xenios-hmac: []
tags:
  - name: Orders
    description: >-
      Place, cancel, and read your orders. Placement is idempotent on
      client_order_id.
  - name: Order Book
    description: Top-of-book depth snapshots for a trading pair.
  - name: Products
    description: Tradable products and pairs, plus OHLCV candles for charting.
  - name: Assets
    description: The assets available to your account.
  - name: Wallets
    description: Generate deposit addresses and read deposit history.
  - name: Account
    description: Your trading fee and effective account settings.
  - name: Health
    description: Liveness and readiness probes.
paths:
  /product/rates:
    get:
      tags:
        - Products
      summary: Get OHLCV candles for a product
      description: >-
        Returns historical OHLCV candles for the given product, ordered
        oldest-first.

              **`timeframe` is the candle bucket size**, not a history length.
              The server picks an appropriate Coinbase Advanced Trade granularity
              and a sensible lookback per timeframe so the chart shows ~100–300 candles:

              | `timeframe` | Granularity (Advanced Trade) | Candles returned | Total span |
              | --- | --- | --- | --- |
              | `1m`  | ONE_MINUTE      | 240 | 4 hours    |
              | `5m`  | FIVE_MINUTE     | 288 | 24 hours   |
              | `15m` | FIFTEEN_MINUTE  | 192 | 2 days     |
              | `1h`  | ONE_HOUR        | 168 | 1 week     |
              | `4h`  | TWO_HOUR        | 144 | 12 days    |
              | `1d`  | ONE_DAY         | 90  | 3 months   |
              | `1w`  | ONE_DAY         | 180 | ~6 months  |
              | `1M`  | ONE_DAY         | 270 | ~9 months  |
              | `1Y`  | ONE_DAY         | 290 | ~10 months |

              Coinbase Advanced Trade caps a single response at ~300 candles and
              has no native `FOUR_HOUR` / weekly / monthly / yearly granularity.
              `4h` is approximated with `TWO_HOUR` candles, and the longer
              labels use daily candles with progressively wider lookbacks.

              The legacy `granularity` query param is accepted but ignored — the
              server derives it from `timeframe` to prevent the two from drifting.
      operationId: getProductCandles
      parameters:
        - name: productId
          required: true
          in: query
          description: Trading pair id (e.g. `BTC-USDC`).
          schema:
            example: BTC-USDC
            type: string
        - name: timeframe
          required: true
          in: query
          description: >-
            Candle bucket size. The server picks the Coinbase granularity and a
            sensible lookback for each value — see the operation description for
            the table.
          schema:
            example: 1h
            type: string
            enum:
              - 1m
              - 5m
              - 15m
              - 1h
              - 4h
              - 1d
              - 1w
              - 1M
              - 1Y
        - name: granularity
          required: false
          in: query
          description: >-
            Ignored — kept for backward compatibility. The server derives the
            effective granularity from `timeframe`. Older clients can still send
            a CandlesGranularity value; new code should just omit this.
          schema:
            type: string
            enum:
              - ONE_MINUTE
              - FIVE_MINUTES
              - FIFTEEN_MINUTES
              - ONE_HOUR
              - SIX_HOURS
              - ONE_DAY
              - THIRTY_MINUTES
              - TWO_HOURS
              - FOUR_HOURS
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ApiResponse'
                  - properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/TradingCandleDto'
      security:
        - xenios-hmac:
            - read:market-data
components:
  schemas:
    ApiResponse:
      type: object
      properties:
        statusCode:
          type: number
          description: HTTP status code echoed in the body.
          example: 200
        success:
          type: boolean
          description: True for success responses.
          example: true
        message:
          type: string
          description: Human-readable status message.
          example: Request processed successfully
      required:
        - statusCode
        - success
    TradingCandleDto:
      type: object
      properties:
        start:
          type: string
          description: Candle start (ISO 8601 or unix seconds, see source).
          example: '2026-05-15T00:00:00Z'
        open:
          type: string
          description: Opening price of the period (quote currency).
          example: '67120.55'
        high:
          type: string
          description: Highest traded price during the period.
          example: '67890.40'
        low:
          type: string
          description: Lowest traded price during the period.
          example: '66980.10'
        close:
          type: string
          description: Closing price of the period.
          example: '67432.18'
        volume:
          type: string
          description: Total traded volume during the period (base currency).
          example: '1284.532'
      required:
        - start
  securitySchemes:
    xenios-hmac:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        HMAC-SHA256 authentication. Sign every request and send X-API-KEY,
        X-API-SIGNATURE, X-API-TIMESTAMP and X-API-NONCE (see the Authentication
        guide). Each route also requires a specific claim on your API key (e.g.
        read:orders, write:orders, read:account, read:market-data).

````