curl --request GET \
--url https://{environment}.pragma.build/node/v1/aggregation/candlestick/{base}/{quote} \
--header 'x-api-key: <api-key>'import requests
url = "https://{environment}.pragma.build/node/v1/aggregation/candlestick/{base}/{quote}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://{environment}.pragma.build/node/v1/aggregation/candlestick/{base}/{quote}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{environment}.pragma.build/node/v1/aggregation/candlestick/{base}/{quote}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{environment}.pragma.build/node/v1/aggregation/candlestick/{base}/{quote}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{environment}.pragma.build/node/v1/aggregation/candlestick/{base}/{quote}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{environment}.pragma.build/node/v1/aggregation/candlestick/{base}/{quote}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"close": "82208749021850000000000",
"high": "82289627995410000000000",
"low": "82023393045000000000000",
"open": "82069269773700000000000",
"time": "2025-03-10T07:30:00"
}
],
"pair_id": "BTC/USD"
}{
"happened_at": "2025-03-10T08:27:29.324879945Z",
"message": "Invalid timestamp: Timestamp range error: End timestamp is in the future",
"resource": "EntryModel"
}{
"happened_at": "2025-03-10T08:27:29.324879945Z",
"message": "Entry not found",
"resource": "EntryModel"
}{
"happened_at": "2025-03-10T08:27:29.324879945Z",
"message": "Database error: connection failed",
"resource": "EntryModel"
}Candlestick Aggregation
curl --request GET \
--url https://{environment}.pragma.build/node/v1/aggregation/candlestick/{base}/{quote} \
--header 'x-api-key: <api-key>'import requests
url = "https://{environment}.pragma.build/node/v1/aggregation/candlestick/{base}/{quote}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://{environment}.pragma.build/node/v1/aggregation/candlestick/{base}/{quote}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{environment}.pragma.build/node/v1/aggregation/candlestick/{base}/{quote}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{environment}.pragma.build/node/v1/aggregation/candlestick/{base}/{quote}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{environment}.pragma.build/node/v1/aggregation/candlestick/{base}/{quote}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{environment}.pragma.build/node/v1/aggregation/candlestick/{base}/{quote}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"close": "82208749021850000000000",
"high": "82289627995410000000000",
"low": "82023393045000000000000",
"open": "82069269773700000000000",
"time": "2025-03-10T07:30:00"
}
],
"pair_id": "BTC/USD"
}{
"happened_at": "2025-03-10T08:27:29.324879945Z",
"message": "Invalid timestamp: Timestamp range error: End timestamp is in the future",
"resource": "EntryModel"
}{
"happened_at": "2025-03-10T08:27:29.324879945Z",
"message": "Entry not found",
"resource": "EntryModel"
}{
"happened_at": "2025-03-10T08:27:29.324879945Z",
"message": "Database error: connection failed",
"resource": "EntryModel"
}Authorizations
Query Parameters
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 UTCnull: Returns the most recent price update
NOTE: This only works for median aggregation
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 trading1s: 1 second - Real-time trading5s: 5 seconds - Short-term price movements1min: 1 minute - Intraday trading15min: 15 minutes - Medium-term analysis1h: 1 hour - Daily trading patterns2h: 2 hours (default) - Extended market analysis1d: 1 day - Long-term trends1w: 1 week - Strategic market overview
100ms, 1s, 5s, 10s, 1min, 5min, 15min, 1h, 2h, 1d, 1w 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/USD
Default: true
Method used to aggregate prices from multiple sources.
Available modes
median: Middle value (default, more manipulation resistant)mean: Average of all valuestwap: Time-Weighted Average Price
median, twap Type of market entry to retrieve
Available types
spot: Spot market prices (default)perp: Perpetual futures pricesfuture: Fixed-expiry futures prices
spot, perp, future Expiry date for future contracts in ISO 8601 format.
Only applicable when entry_type is "future".
Example
"2024-12-31": December 31, 2024 expirynull: Not applicable for spot/perp markets
Include source components in the response. When true, the response will include price data from individual sources.
Example
true: Include source breakdown in responsefalse: Return aggregated data only (default)
Was this page helpful?