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

# Candles

> Get OHLCV candlestick data for a Binance trading pair

Fetch OHLCV candlestick data derived from Binance book ticker mid-prices. Supported intervals: `1s`, `1m`, `5m`, `15m`, `1h`, `4h`, `1d`.

<Note>**Requires Dev or Pro tier.** This endpoint is not available on the Free tier.</Note>

| Constraint | Value                 |
| ---------- | --------------------- |
| `limit`    | 1–1,500 (default 500) |

### Time Range Limits

| Interval | Max Range |
| -------- | --------- |
| `1s`     | 1 hour    |
| `1m`     | 7 days    |
| `5m`     | 30 days   |
| `15m`    | 90 days   |
| `1h`     | 180 days  |
| `4h`     | 365 days  |
| `1d`     | 730 days  |

Useful for backtesting crypto up/down prediction markets:

* `15m` for 15-minute markets
* `1h` for 1-hour markets
* `4h` and `1d` for longer timeframes


## OpenAPI

````yaml GET /v2/binance/candles/{symbol}
openapi: 3.1.0
info:
  title: Predexon API
  description: Prediction market data aggregation and matching API
  version: 2.0.0
servers:
  - url: https://api.predexon.com
security:
  - apiKey: []
paths:
  /v2/binance/candles/{symbol}:
    get:
      tags:
        - binance
      summary: Get Binance Candles
      description: >-
        Fetch OHLCV candlestick data for a Binance trading pair.


        Candle prices are derived from book ticker mid-prices (not trade
        prices).


        **Backtesting crypto up/down markets:**

        - Use `interval=15m` for 15-minute prediction markets

        - Use `interval=1h` for 1-hour prediction markets

        - Use `interval=4h` and `interval=1d` for longer timeframes
      operationId: get_binance_candles_v2_binance_candles__symbol__get
      parameters:
        - name: symbol
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/BinanceSymbol'
            description: Trading pair
          description: Trading pair
        - name: interval
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/BinanceInterval'
            description: Candle interval
            default: 1m
          description: Candle interval
        - name: start_time
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
                minimum: 0
              - type: 'null'
            description: Unix timestamp (seconds) for range start
            title: Start Time
          description: Unix timestamp (seconds) for range start
        - name: end_time
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
                minimum: 0
              - type: 'null'
            description: Unix timestamp (seconds) for range end
            title: End Time
          description: Unix timestamp (seconds) for range end
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 1500
            minimum: 1
            description: Max candles to return
            default: 500
            title: Limit
          description: Max candles to return
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BinanceCandlesResponse'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
components:
  schemas:
    BinanceSymbol:
      type: string
      enum:
        - BTCUSDT
        - ETHUSDT
        - SOLUSDT
        - XRPUSDT
      title: BinanceSymbol
      description: Supported Binance trading pairs for crypto up/down market backtesting.
    BinanceInterval:
      type: string
      enum:
        - 1s
        - 1m
        - 5m
        - 15m
        - 1h
        - 4h
        - 1d
      title: BinanceInterval
      description: |-
        Candlestick intervals aligned with crypto up/down market timeframes.

        - 1s, 1m: high-resolution data from pre-aggregated tables
        - 5m, 15m, 1h, 4h, 1d: aggregated on-the-fly from 1m candles
    BinanceCandlesResponse:
      properties:
        symbol:
          type: string
          title: Symbol
          description: Trading pair (e.g. BTCUSDT)
        interval:
          type: string
          title: Interval
          description: Candle interval (e.g. 15m, 1h)
        candles:
          items:
            $ref: '#/components/schemas/BinanceCandleData'
          type: array
          title: Candles
          description: Array of candles, ordered by timestamp ASC
      type: object
      required:
        - symbol
        - interval
        - candles
      title: BinanceCandlesResponse
      description: >-
        OHLCV candlestick response for a Binance trading pair.


        Intervals 1s and 1m are served from pre-aggregated materialized views.

        Larger intervals (5m, 15m, 1h, 4h, 1d) are aggregated on-the-fly from 1m
        data.
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
        message:
          type: string
          title: Message
      type: object
      required:
        - error
        - message
      title: ErrorResponse
      description: Standard error response.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    BinanceCandleData:
      properties:
        timestamp:
          type: integer
          title: Timestamp
          description: Unix timestamp (seconds) at period start
        open:
          type: number
          title: Open
          description: Opening mid-price in USDT
        high:
          type: number
          title: High
          description: Highest mid-price in USDT
        low:
          type: number
          title: Low
          description: Lowest mid-price in USDT
        close:
          type: number
          title: Close
          description: Closing mid-price in USDT
        tick_count:
          type: integer
          title: Tick Count
          description: Number of book ticker updates in this candle
        avg_spread:
          type: number
          title: Avg Spread
          description: Average bid-ask spread over this candle
      type: object
      required:
        - timestamp
        - open
        - high
        - low
        - close
        - tick_count
        - avg_spread
      title: BinanceCandleData
      description: |-
        Single OHLCV candlestick derived from book ticker mid-prices.

        Open/high/low/close reflect the mid-price (not trade price).
        tick_count indicates market activity density within the candle.
      examples:
        - avg_spread: 0.1
          close: 103275.3
          high: 103300.5
          low: 103200
          open: 103250.12
          tick_count: 15420
          timestamp: 1706745600
    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:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````