Get aggregated candles data per instrument
curl --request GET \
--url https://api.international.coinbase.com/api/v1/instruments/{instrument}/candlesimport requests
url = "https://api.international.coinbase.com/api/v1/instruments/{instrument}/candles"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.international.coinbase.com/api/v1/instruments/{instrument}/candles', 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://api.international.coinbase.com/api/v1/instruments/{instrument}/candles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://api.international.coinbase.com/api/v1/instruments/{instrument}/candles"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.international.coinbase.com/api/v1/instruments/{instrument}/candles")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.international.coinbase.com/api/v1/instruments/{instrument}/candles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"aggregations": [
{
"start": "2024-04-23T00:00:00Z",
"open": "62884.4",
"high": "64710.6",
"low": "62884.4",
"close": "63508.4",
"volume": "3253.9983"
}
]
}Instruments
Get aggregated candles data per instrument
Retrieves a list of aggregated candles data for a given instrument, granularity and time range
GET
/
api
/
v1
/
instruments
/
{instrument}
/
candles
Get aggregated candles data per instrument
curl --request GET \
--url https://api.international.coinbase.com/api/v1/instruments/{instrument}/candlesimport requests
url = "https://api.international.coinbase.com/api/v1/instruments/{instrument}/candles"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.international.coinbase.com/api/v1/instruments/{instrument}/candles', 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://api.international.coinbase.com/api/v1/instruments/{instrument}/candles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://api.international.coinbase.com/api/v1/instruments/{instrument}/candles"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.international.coinbase.com/api/v1/instruments/{instrument}/candles")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.international.coinbase.com/api/v1/instruments/{instrument}/candles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"aggregations": [
{
"start": "2024-04-23T00:00:00Z",
"open": "62884.4",
"high": "64710.6",
"low": "62884.4",
"close": "63508.4",
"volume": "3253.9983"
}
]
}- Java
- .NET
- Python
- TS/JS
InstrumentsService instrumentsService = IntxServiceFactory.createInstrumentsService(client);
GetAggregatedCandlesRequest request = new GetAggregatedCandlesRequest.Builder()
.instrumentId("BTC-PERP")
.granularity("ONE_DAY")
.start("2024-01-01T00:00:00Z")
.build();
GetAggregatedCandlesResponse response = instrumentsService.getAggregatedCandles(request);
var instrumentsService = new InstrumentsService(client);
var request = new GetAggregatedCandlesRequest(
InstrumentId: "BTC-PERP",
Granularity: "ONE_DAY",
Start: "2024-01-01T00:00:00Z",
);
var response = instrumentsService.GetAggregatedCandles(request);
client = IntxClient()
request = GetAggregatedCandlesRequest(
instrument_id="BTC-PERP",
granularity="ONE_DAY",
start="2024-01-01T00:00:00Z",
)
response = client.get_aggregated_candles(request)
const instrumentsService = new InstrumentsService(client);
instrumentsService.getAggregatedCandles({
instrumentId: 'BTC-PERP',
granularity: 'ONE_DAY',
start: '2024-01-01T00:00:00Z',
}).then(async (response) => {
console.log('Aggregated Candles: ', response);
})
Path Parameters
Identifies the instrument by name (e.g., BTC-PERP)
Query Parameters
The aggregation period of the candles data. End timestamp in ISO 8601 timestamp format (e.g. 2024-03-01T00:00:00Z).
Available options:
ONE_DAY, SIX_HOUR, TWO_HOUR, ONE_HOUR, THIRTY_MINUTE, FIFTEEN_MINUTE, FIVE_MINUTE, ONE_MINUTE Start timestamp in ISO 8601 timestamp format (e.g. 2024-03-01T00:00:00Z)
End timestamp in ISO 8601 timestamp format (e.g. 2024-03-01T00:00:00Z)
Response
Instrument list
Show child attributes
Show child attributes
Was this page helpful?