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

# Get OHLCV candles

> Return OHLCV candles for a single asset and interval.

Wraps Hyperliquid's ``candleSnapshot`` info type and adds the xyz: HIP-3 DEX
prefix server-side so the SDK only needs the bare ticker (e.g. ``AAPL``).
Candle ``time`` is returned in unix seconds, ready for TradingView
lightweight-charts. Cached for 15 seconds per (symbol, interval, window).



## OpenAPI

````yaml /v2/combined_spec.json get /v2/global_markets_perps/candles
openapi: 3.1.0
info:
  title: Compass API
  description: Compass Labs DeFi API
  version: 0.0.1
servers:
  - url: https://api.compasslabs.ai
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /v2/global_markets_perps/candles:
    get:
      tags:
        - Global Markets Perps
      summary: Get OHLCV candles
      description: >-
        Return OHLCV candles for a single asset and interval.


        Wraps Hyperliquid's ``candleSnapshot`` info type and adds the xyz: HIP-3
        DEX

        prefix server-side so the SDK only needs the bare ticker (e.g.
        ``AAPL``).

        Candle ``time`` is returned in unix seconds, ready for TradingView

        lightweight-charts. Cached for 15 seconds per (symbol, interval,
        window).
      operationId: v2_global_markets_perps_candles
      parameters:
        - name: symbol
          in: query
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 64
            title: Symbol
            default: AAPL
          description: >-
            Asset ticker (e.g. AAPL, GOLD, EUR). The xyz: HIP-3 DEX prefix is
            added server-side if not already present.
        - name: interval
          in: query
          required: true
          schema:
            type: string
            enum:
              - 1m
              - 5m
              - 15m
              - 1h
              - 4h
              - 1d
              - 1w
            title: CandleInterval
            default: 1h
          description: 'Candle interval: 1m, 5m, 15m, 1h, 4h, 1d, 1w'
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 5000
            minimum: 1
            default: 200
            title: Limit
          description: Number of candles to return (max 5000, capped by Hyperliquid).
        - name: start_time
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            title: Start Time
            default: null
          description: >-
            Optional start of the candle window in unix milliseconds. If
            omitted, computed as end_time - limit * interval.
        - name: end_time
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            title: End Time
            default: null
          description: >-
            Optional end of the candle window in unix milliseconds. Defaults to
            now.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GlobalMarketsPerpsCandlesResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: python
          label: Python (SDK)
          source: |-
            from compass_api_sdk import CompassAPI, models


            with CompassAPI(
                api_key_auth="<YOUR_API_KEY_HERE>",
            ) as compass_api:

                res = compass_api.global_markets_perps.global_markets_perps_candles(symbol="AAPL", interval=models.CandleInterval.ONEH, limit=200)

                # Handle response
                print(res)
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { CompassApiSDK } from "@compass-labs/api-sdk";

            const compassApiSDK = new CompassApiSDK({
              apiKeyAuth: "<YOUR_API_KEY_HERE>",
            });

            async function run() {
              const result = await compassApiSDK.globalMarketsPerps.globalMarketsPerpsCandles({
                symbol: "AAPL",
                interval: "1h",
                limit: 200,
              });

              console.log(result);
            }

            run();
components:
  schemas:
    GlobalMarketsPerpsCandlesResponse:
      properties:
        symbol:
          type: string
          title: Symbol
          description: Asset ticker the candles are for (without DEX prefix)
        interval:
          type: string
          title: Interval
          description: Candle interval that was requested
        candles:
          items:
            $ref: '#/components/schemas/Candle'
          type: array
          title: Candles
          description: Candles ordered oldest → newest
      type: object
      required:
        - symbol
        - interval
        - candles
      title: GlobalMarketsPerpsCandlesResponse
      description: OHLCV candle series for a single asset/interval.
      example:
        candles:
          - close: '213.88'
            high: '214.20'
            low: '213.10'
            open: '213.45'
            time: 1747008000
            trades: 312
            volume: '1842.5'
          - close: '214.92'
            high: '215.05'
            low: '213.70'
            open: '213.88'
            time: 1747011600
            trades: 388
            volume: '2104.2'
        interval: 1h
        symbol: AAPL
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Candle:
      properties:
        time:
          type: integer
          title: Time
          description: >-
            Candle open time as unix seconds (already converted from
            Hyperliquid's milliseconds — drop-in compatible with TradingView
            lightweight-charts).
        open:
          type: string
          title: Open
          description: Open price
        high:
          type: string
          title: High
          description: High price
        low:
          type: string
          title: Low
          description: Low price
        close:
          type: string
          title: Close
          description: Close price
        volume:
          type: string
          title: Volume
          description: Volume in base asset units
        trades:
          type: integer
          title: Trades
          description: Number of trades in this candle
      type: object
      required:
        - time
        - open
        - high
        - low
        - close
        - volume
        - trades
      title: Candle
      description: A single OHLCV candle.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Your Compass API Key. Get your key
        [here](https://www.compasslabs.ai/dashboard).

````