Skip to content

Get Candles

Retrieve OHLCV (Open, High, Low, Close, Volume) price data for a specific trading pair.

Endpoint

POST https://papi.synthetix.io/v1/info

Request

Request Format

{
  "params": {
    "action": "getCandles",
    "symbol": "BTC-USDT",
    "interval": "1h",
    "limit": 500,
    "startTime": 1704067200000,
    "endTime": 1704153600000
  }
}

Request Parameters

ParameterTypeRequiredDescription
params.actionstringYesMust be "getCandles"
params.symbolstringYesTrading pair symbol (e.g., "BTC-USDT")
params.intervalstringYesTime interval: 1m, 5m, 15m, 1h, 4h, 1d, 1w, 1M
params.limitintegerNoNumber of candles to return (0 = no limit)
params.startTimeintegerNoStart time in milliseconds (default: 24 hours ago)
params.endTimeintegerNoEnd time in milliseconds (default: current time)

Valid Intervals

IntervalDescriptionMilliseconds
1m1 minute60,000
5m5 minutes300,000
15m15 minutes900,000
1h1 hour3,600,000
4h4 hours14,400,000
1d1 day86,400,000
1w1 week604,800,000
1M1 month2,592,000,000

Response

Success Response

{
  "status": "ok",
  "response": {
    "symbol": "BTC-USDT",
    "interval": "1h",
    "candles": [
      {
        "openTime": 1704067200000,
        "closeTime": 1704070800000,
        "openPrice": "45000.50",
        "highPrice": "45100.00",
        "lowPrice": "44950.00",
        "closePrice": "45050.00",
        "volume": "125.5",
        "quoteVolume": "125500.00",
        "tradeCount": 1523
      },
      {
        "openTime": 1704070800000,
        "closeTime": 1704074400000,
        "openPrice": "45050.00",
        "highPrice": "45200.00",
        "lowPrice": "45000.00",
        "closePrice": "45150.00",
        "volume": "98.2",
        "quoteVolume": "98450.00",
        "tradeCount": 1102
      }
    ]
  },
  "request_id": "5ccf215d37e3ae6d"
}

Candle Response Object

FieldTypeDescription
symbolstringTrading pair symbol
intervalstringTime interval used
candlesarrayArray of candle objects

Candle Object

FieldTypeDescription
openTimeintegerCandle open time in milliseconds
closeTimeintegerCandle close time in milliseconds
openPricestringOpening price
highPricestringHighest price during the period
lowPricestringLowest price during the period
closePricestringClosing price
volumestringBase asset trading volume
quoteVolumestringQuote asset trading volume
tradeCountintegerNumber of trades in the period

Error Response

{
  "status": "error",
  "error": {
    "message": "Invalid request parameters",
    "code": "VALIDATION_ERROR"
  },
  "request_id": "5ccf215d37e3ae6d"
}

Code Examples

Get Recent 1-Hour Candles

{
  "params": {
    "action": "getCandles",
    "symbol": "BTC-USDT",
    "interval": "1h",
    "limit": 100
  }
}

Get Daily Candles for Date Range

{
  "params": {
    "action": "getCandles",
    "symbol": "ETH-USDT",
    "interval": "1d",
    "startTime": 1704067200000,
    "endTime": 1704153600000,
    "limit": 30
  }
}

Candle Data Information

  • OHLCV Format: Standard Open, High, Low, Close, Volume data
  • Flexible Timeframes: Multiple intervals from 1 minute to 1 month
  • Configurable Limits: Set limit to 0 for no limit, or specify desired number of candles
  • Time Range Support: Optional start and end time filtering
  • Real-time Data: Latest market data with minimal delay

Use Cases

  • Technical Analysis: Chart patterns, indicators, and analysis
  • Trading Strategies: Backtesting and strategy development
  • Market Research: Historical price movement analysis
  • Risk Management: Volatility and trend analysis
  • Performance Tracking: Portfolio performance over time

Validation Rules

  • symbol must be a valid trading pair
  • interval must be one of the valid intervals
  • limit must be non-negative (≥ 0), where 0 means no limit
  • startTime must be less than endTime if both provided
  • No authentication required

Error Handling

Common error scenarios:

Error CodeDescriptionRetryable
UNAUTHORIZEDEIP-712 signature validation failedNo
VALIDATION_ERRORRequest validation failedNo
MISSING_REQUIRED_FIELDRequired field is missingNo
INVALID_FORMATField format is invalidNo
INVALID_VALUEInvalid parameter valueNo
RATE_LIMIT_EXCEEDEDToo many requests in time windowYes
INSUFFICIENT_MARGINNot enough margin for tradeNo
ORDER_NOT_FOUNDOrder does not existNo
OPERATION_TIMEOUTOperation timed outYes
ErrorDescription
Symbol requiredMissing trading pair symbol
Invalid intervalUnsupported time interval
Invalid limitLimit must be non-negative
Invalid time rangeStart time is after end time
Failed to retrieve dataInternal service error

Rate Limiting

  • Default: 1000 requests per minute per IP
  • Burst: Up to 100 requests per second
  • Data Volume: Large requests may be rate-limited

Related Endpoints