Skip to content

Historical Data

These endpoints return OHLC (Open, High, Low, Close) data for a specified token pair over a defined time range. You can filter by exchange or retrieve aggregated candles across multiple exchanges.

Endpoint Overview

Method Endpoint Description
GET /v1/historical/OLHC/{baseTokenId}/{targetTokenId} Fetch OHLC data by token IDs.
GET /v1/historical/OLHC/symbols/{baseSymbol}/{targetSymbol} Fetch OHLC data by symbols.

Retrieve Historical OHLC Data

GET /v1/historical/OLHC/{baseTokenId}/{targetTokenId}
GET /v1/historical/OLHC/symbols/{baseSymbol}/{targetSymbol}

Purpose: Fetches historical OHLC (Open, High, Low, Close) data for two tokens, identified either by token IDs or symbols.

Path Parameters (by Token IDs):

Name Type Mandatory Description
baseTokenId number Yes Token ID of the base token.
targetTokenId number Yes Token ID of the target token.

Path Parameters (by Symbols):

Name Type Mandatory Description
baseSymbol string Yes Symbol of the base token.
targetSymbol string Yes Symbol of the target token.

Query Parameters:

Name Type Mandatory Description
candlesize integer Yes Candle interval in minutes (e.g., 1, 5, 15, 30, 60, 240).
limit integer No Maximum number of candles to retrieve (default = 100).
offset integer No Offset for pagination, default 0.
exchange string No Exchange name or "ALL" for aggregated data (default: "ALL").
startTimestamp long No UTC epoch timestamp for start of data range. Closest candle ≥ this timestamp.
endTimestamp long No UTC epoch timestamp for end of data range. Closest candle ≤ this timestamp.
side integer No Price type: 1 (ask), 2 (bid). Default is 1 (ask).

Example Requests

GET /v1/historical/OLHC/130/5898?candlesize=30&limit=5&exchange=ALL
GET /v1/historical/OLHC/symbols/BTC/USDT?candlesize=15&limit=3

Example Response

{
  "data": {
    "baseSymbol": "BTC",              // Symbol of the base token
    "targetSymbol": "USDT",           // Symbol of the target token
    "baseTokenId": 130,               // Token ID of the base token
    "targetTokenId": 5898,            // Token ID of the target token
    "exchange": "ALL",                // Exchange source ("ALL" means aggregated data)
    "candleSize": 15,                 // Candle interval (minutes)
    "type": 1,                        // Price type (1: ask, 2: bid)
    "limit": 3,                       // Number of OHLC entries returned
    "offset": 0,                      // Pagination offset
    "ohlc": [
      {
        "time": "3/9/2025 6:00:00 AM",  // Human-readable candle start time (UTC)
        "timestamp": 1741500000000,     // UTC epoch timestamp for candle
        "open": 86064.7,               // Opening price
        "close": 86018.2,              // Closing price
        "high": 86121,                 // Highest price within candle period
        "low": 86000.1                 // Lowest price within candle period
      },
      {
        "time": "3/9/2025 5:45:00 AM",
        "timestamp": 1741499100000,
        "open": 86110.0,
        "close": 86064.7,
        "high": 86200,
        "low": 86010.2
      },
      ...
    ],
    "success": true,
    "timestamp": 1741070894747,
    "requestId": "unique-request-id",
    "message": "",
    "error": null
  }
}

Usage Tips

  1. Pagination: If you need more than 100 records, adjust offset or time ranges accordingly.
  2. startTimestamp / endTimestamp:
  3. The API finds the closest candle to these boundaries.
  4. The timestamp in each OHLC record corresponds to the start of that candle.
  5. Aggregated Data: When exchange=ALL, the system merges trades from all connected exchanges into a single time series.
  6. Candle Time: The time string might show a local-time format in examples. The real anchor is the timestamp (UTC epoch) for the open of that candle.