GET
/
node
/
v1
/
aggregation
/
candlestick
/
{base}
/
{quote}
curl --request GET \
  --url https://{environment}.pragma.build/node/v1/aggregation/candlestick/{base}/{quote} \
  --header 'x-api-key: <api-key>'
{
  "data": [
    {
      "close": "82208749021850000000000",
      "high": "82289627995410000000000",
      "low": "82023393045000000000000",
      "open": "82069269773700000000000",
      "time": "2025-03-10T07:30:00"
    }
  ],
  "pair_id": "BTC/USD"
}

Authorizations

x-api-key
string
header
required

Path Parameters

base
string
required

Base asset symbol

quote
string
required

Quote asset symbol

Query Parameters

timestamp
any | null

The unix timestamp in seconds to retrieve historical price data. This endpoint will return the first update whose timestamp is <= the provided value.

If not provided, returns the latest available price.

Examples

  • 1_647_820_800: Returns price data from March 21, 2022 00:00:00 UTC
  • null: Returns the most recent price update
interval
enum<string> | null

Time interval for aggregated price data. Different intervals affect how price data is aggregated and can be used to get OHLC (Open/High/Low/Close) data at various timeframes.

Available intervals

  • 100ms: 100 milliseconds - High frequency trading
  • 1s: 1 second - Real-time trading
  • 5s: 5 seconds - Short-term price movements
  • 1min: 1 minute - Intraday trading
  • 15min: 15 minutes - Medium-term analysis
  • 1h: 1 hour - Daily trading patterns
  • 2h: 2 hours (default) - Extended market analysis
  • 1d: 1 day - Long-term trends
  • 1w: 1 week - Strategic market overview
Available options:
100ms,
1s,
5s,
1min,
15min,
1h,
2h,
1d,
1w
routing
boolean | null

Enable price routing through intermediate pairs. When true, if a direct price for the requested pair is not available, the system will attempt to calculate it using intermediate pairs.

Example

For BTC/EUR when routing is enabled:

  • If direct BTC/EUR price is unavailable
  • System might route through BTC/USD and EUR/EUR

Default: true

aggregation
enum<string> | null

Method used to aggregate prices from multiple sources.

Available modes

  • median: Middle value (default, more manipulation resistant)
  • mean: Average of all values
  • twap: Time-Weighted Average Price
Available options:
median,
mean,
twap
entry_type
enum<string> | null

Type of market entry to retrieve

Available types

  • spot: Spot market prices (default)
  • perp: Perpetual futures prices
  • future: Fixed-expiry futures prices
Available options:
spot,
perp,
future
expiry
string | null

Expiry date for future contracts in ISO 8601 format. Only applicable when entry_type is "future".

Example

  • "2024-12-31": December 31, 2024 expiry
  • null: Not applicable for spot/perp markets

Response

200
application/json
Successfully retrieved OHLC data

Response containing OHLC (candlestick) data for a trading pair

data
object[]
required

Array of OHLC entries ordered by timestamp

pair_id
string
required

Trading pair identifier (e.g., "BTC/USD")