Pacifica
  • Getting Started
    • Closed Alpha Guide
      • Link To Guide PDF
    • Closed Alpha Trading Competition
  • Trading on Pacifica
    • Overview
    • Contract Specifications
      • Oracle Price & Mark Price
      • Settlement Mechanism
    • Order Types
      • Market Order
      • Limit Order
      • Order Rules & Constraints
    • Margin & Leverage
    • Funding Rates
    • Liquidations
  • API Documentation
    • API
      • REST API
        • Markets
          • Get market info
          • Get prices
          • Get kline (candle) data
          • Get recent trades
        • Account
          • Get account info
          • Get account settings
          • Update leverage
          • Update margin mode
          • Get positions
          • Get trade history
          • Get funding history
          • Get account equity history
          • Create subaccount
          • Request withdrawal
        • Orders
          • Get open orders
          • Get order history
          • Get order history by ID
          • Create order
          • Create stop order
          • Create position TP/SL
          • Cancel order
          • Cancel all orders
          • Cancel stop order
          • Batch orders
      • Websocket
        • Subscriptions
          • Prices
          • Orderbook
          • Trades
          • Candle
          • Order updates
          • Account balance
          • Account margin
          • Account leverage
          • Account positions
          • Account orders
          • Account order updates
          • Account trades
        • Trading operations
          • Create order
          • Cancel order
          • Cancel all orders
      • Signing
      • Rate limits
    • Specification
  • Other
    • Audits
    • Brand Assets
    • Contact Us
    • Glossary of Terms
Powered by GitBook
On this page
  1. API Documentation
  2. API
  3. REST API
  4. Markets

Get kline (candle) data

This endpoint allows users to get historical price candles for a specific market and time interval.

/api/v1/kline

Query Parameters

Field
Type
Need
Description
Example

"symbol"

string

required

Trading pair symbol

BTC

"interval"

string

required

Candlestick interval Valid values: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 8h, 12h, 1d

1m

"start_time"

integer

required

Start time in milliseconds

1716200000000

"end_time"

integer

optional

End time in milliseconds, defaults to current time if not provided

1742243220000

/api/v1/kline?symbol=BTC&interval=1m&start_time=1742243160000&end_time=1742243220000

Response

  • Status 200: Successfully retrieved kline data

  [
    {
      "t": 1742243160000,
      "T": 1742243220000,
      "s": "BTC",
      "i": "1m",
      "o": "84108",
      "c": "84072",
      "h": "84108",
      "l": "84072",
      "v": "0.1944"
      "n": 58,
    }
  ]
Field
Type
Description

't'

number

Candle start time

'T'

number

Candle end time

's'

string

Symbol

'i'

string

Time interval

'o'

decimal string

Open price

'c'

decimal string

Close price

'h'

decimal string

High price

'l'

decimal string

Low price

'v'

decimal string

Volume

'n'

number

Number of trades

  • Status 400: Invalid request parameters

  • Status 401: Unauthorized access

  • Status 500: Internal server error

Code Example (Python)

import requests

response = requests.get(
    "/api/v1/kline?symbol=BTC&interval=1m&start_time=1742243160000&end_time=1742243220000",
    headers={"Accept": "*/*"},
)

data = response.json()
PreviousGet pricesNextGet recent trades

Last updated 2 days ago