OHLC chart data for date range
curl --request GET \
--url 'https://api.xchangeapi.com/{format}/chart/{currency-pair}?starttime={starttime}&endtime={endtime}' \
--header 'api-key: <api-key>'import requests
url = "https://api.xchangeapi.com/{format}/chart/{currency-pair}?starttime={starttime}&endtime={endtime}"
headers = {"api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'api-key': '<api-key>'}};
fetch('https://api.xchangeapi.com/{format}/chart/{currency-pair}?starttime={starttime}&endtime={endtime}', 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.xchangeapi.com/{format}/chart/{currency-pair}?starttime={starttime}&endtime={endtime}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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://api.xchangeapi.com/{format}/chart/{currency-pair}?starttime={starttime}&endtime={endtime}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("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://api.xchangeapi.com/{format}/chart/{currency-pair}?starttime={starttime}&endtime={endtime}")
.header("api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.xchangeapi.com/{format}/chart/{currency-pair}?starttime={starttime}&endtime={endtime}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"1577836800": [
1.12182,
1.1221,
1.12182,
1.1221,
1.12169,
1.12199,
1.12169,
1.12199
],
"1577836920": [
1.12181,
1.12182,
1.12181,
1.12181,
1.12169,
1.12169,
1.12169,
1.12169
],
"1577836860": [
1.12181,
1.12182,
1.12181,
1.12181,
1.12169,
1.12169,
1.12169,
1.12169
]
}
<result>
<item>
<time>1577836800</time>
<min_ask>1.12182</min_ask>
<max_ask>1.1221</max_ask>
<open_ask>1.12182</open_ask>
<close_ask>1.1221</close_ask>
<min_bid>1.12169</min_bid>
<max_bid>1.12199</max_bid>
<open_bid>1.12169</open_bid>
<close_bid>1.12199</close_bid>
</item>
<item>
<time>1577836860</time>
<min_ask>1.12181</min_ask>
<max_ask>1.12182</max_ask>
<open_ask>1.12181</open_ask>
<close_ask>1.12181</close_ask>
<min_bid>1.12169</min_bid>
<max_bid>1.12169</max_bid>
<open_bid>1.12169</open_bid>
<close_bid>1.12169</close_bid>
</item>
<item>
<time>1577836920</time>
<min_ask>1.12181</min_ask>
<max_ask>1.12182</max_ask>
<open_ask>1.12181</open_ask>
<close_ask>1.12181</close_ask>
<min_bid>1.12169</min_bid>
<max_bid>1.12169</max_bid>
<open_bid>1.12169</open_bid>
<close_bid>1.12169</close_bid>
</item>
</result>
time,min_ask,max_ask,open_ask,close_ask,min_bid,max_bid,open_bid,close_bid
1577836800,1.12182,1.1221,1.12182,1.1221,1.12169,1.12199,1.12169,1.12199
1577836860,1.12181,1.12182,1.12181,1.12181,1.12169,1.12169,1.12169,1.12169
1577836920,1.12181,1.12182,1.12181,1.12181,1.12169,1.12169,1.12169,1.12169
Historical Data
OHLC chart data for date range
GET
{format}
/
chart
/
{currency-pair}
?starttime=
{starttime}
&endtime=
{endtime}
OHLC chart data for date range
curl --request GET \
--url 'https://api.xchangeapi.com/{format}/chart/{currency-pair}?starttime={starttime}&endtime={endtime}' \
--header 'api-key: <api-key>'import requests
url = "https://api.xchangeapi.com/{format}/chart/{currency-pair}?starttime={starttime}&endtime={endtime}"
headers = {"api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'api-key': '<api-key>'}};
fetch('https://api.xchangeapi.com/{format}/chart/{currency-pair}?starttime={starttime}&endtime={endtime}', 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.xchangeapi.com/{format}/chart/{currency-pair}?starttime={starttime}&endtime={endtime}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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://api.xchangeapi.com/{format}/chart/{currency-pair}?starttime={starttime}&endtime={endtime}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("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://api.xchangeapi.com/{format}/chart/{currency-pair}?starttime={starttime}&endtime={endtime}")
.header("api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.xchangeapi.com/{format}/chart/{currency-pair}?starttime={starttime}&endtime={endtime}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"1577836800": [
1.12182,
1.1221,
1.12182,
1.1221,
1.12169,
1.12199,
1.12169,
1.12199
],
"1577836920": [
1.12181,
1.12182,
1.12181,
1.12181,
1.12169,
1.12169,
1.12169,
1.12169
],
"1577836860": [
1.12181,
1.12182,
1.12181,
1.12181,
1.12169,
1.12169,
1.12169,
1.12169
]
}
<result>
<item>
<time>1577836800</time>
<min_ask>1.12182</min_ask>
<max_ask>1.1221</max_ask>
<open_ask>1.12182</open_ask>
<close_ask>1.1221</close_ask>
<min_bid>1.12169</min_bid>
<max_bid>1.12199</max_bid>
<open_bid>1.12169</open_bid>
<close_bid>1.12199</close_bid>
</item>
<item>
<time>1577836860</time>
<min_ask>1.12181</min_ask>
<max_ask>1.12182</max_ask>
<open_ask>1.12181</open_ask>
<close_ask>1.12181</close_ask>
<min_bid>1.12169</min_bid>
<max_bid>1.12169</max_bid>
<open_bid>1.12169</open_bid>
<close_bid>1.12169</close_bid>
</item>
<item>
<time>1577836920</time>
<min_ask>1.12181</min_ask>
<max_ask>1.12182</max_ask>
<open_ask>1.12181</open_ask>
<close_ask>1.12181</close_ask>
<min_bid>1.12169</min_bid>
<max_bid>1.12169</max_bid>
<open_bid>1.12169</open_bid>
<close_bid>1.12169</close_bid>
</item>
</result>
time,min_ask,max_ask,open_ask,close_ask,min_bid,max_bid,open_bid,close_bid
1577836800,1.12182,1.1221,1.12182,1.1221,1.12169,1.12199,1.12169,1.12199
1577836860,1.12181,1.12182,1.12181,1.12181,1.12169,1.12169,1.12169,1.12169
1577836920,1.12181,1.12182,1.12181,1.12181,1.12169,1.12169,1.12169,1.12169
Retrieve aggregated chart data (open, high, low, close) for a specific currency pair within a custom time range. This endpoint is ideal for generating historical charts or analyzing market trends over a defined period.
Note on Precision: Some currency pairs are returned with a multiplier (e.g., 100 or 1000) to ensure high precision.
Path parameters
string
default:"json"
The desired output format. Options:
json, xml, csv.If you choose
xml, you must use the POST method. GET requests for XML will fail.Query parameters
string
required
The start of the requested period as a UNIX timestamp (seconds since epoch). Example:
1577836800 (January 1st, 2020).string
required
The end of the requested period as a UNIX timestamp (seconds since epoch). Example:
1577836800 (January 1st, 2020).Response
Response Structure: For a detailed explanation of the array indices (for JSON) and property definitions, please refer to the Response Structures guide.
{
"1577836800": [
1.12182,
1.1221,
1.12182,
1.1221,
1.12169,
1.12199,
1.12169,
1.12199
],
"1577836920": [
1.12181,
1.12182,
1.12181,
1.12181,
1.12169,
1.12169,
1.12169,
1.12169
],
"1577836860": [
1.12181,
1.12182,
1.12181,
1.12181,
1.12169,
1.12169,
1.12169,
1.12169
]
}
<result>
<item>
<time>1577836800</time>
<min_ask>1.12182</min_ask>
<max_ask>1.1221</max_ask>
<open_ask>1.12182</open_ask>
<close_ask>1.1221</close_ask>
<min_bid>1.12169</min_bid>
<max_bid>1.12199</max_bid>
<open_bid>1.12169</open_bid>
<close_bid>1.12199</close_bid>
</item>
<item>
<time>1577836860</time>
<min_ask>1.12181</min_ask>
<max_ask>1.12182</max_ask>
<open_ask>1.12181</open_ask>
<close_ask>1.12181</close_ask>
<min_bid>1.12169</min_bid>
<max_bid>1.12169</max_bid>
<open_bid>1.12169</open_bid>
<close_bid>1.12169</close_bid>
</item>
<item>
<time>1577836920</time>
<min_ask>1.12181</min_ask>
<max_ask>1.12182</max_ask>
<open_ask>1.12181</open_ask>
<close_ask>1.12181</close_ask>
<min_bid>1.12169</min_bid>
<max_bid>1.12169</max_bid>
<open_bid>1.12169</open_bid>
<close_bid>1.12169</close_bid>
</item>
</result>
time,min_ask,max_ask,open_ask,close_ask,min_bid,max_bid,open_bid,close_bid
1577836800,1.12182,1.1221,1.12182,1.1221,1.12169,1.12199,1.12169,1.12199
1577836860,1.12181,1.12182,1.12181,1.12181,1.12169,1.12169,1.12169,1.12169
1577836920,1.12181,1.12182,1.12181,1.12181,1.12169,1.12169,1.12169,1.12169
Was this page helpful?
⌘I
