Candles
List supported candle timeframes
The timeframe ids accepted by the candle, footprint, TPO, and stream endpoints, plus the
count rules that define which further ids are valid (for example 3m or 2h).
Canonical suffixes include M for months and Q for quarters.
Cost: 1000 credits per request (flat).
GET
/
api
/
v1
/
marketdata
/
timeframes
List supported candle timeframes
curl --request GET \
--url https://public-api.takeprofit.com/api/v1/marketdata/timeframes \
--header 'x-api-key: <api-key>'import requests
url = "https://public-api.takeprofit.com/api/v1/marketdata/timeframes"
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://public-api.takeprofit.com/api/v1/marketdata/timeframes', 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://public-api.takeprofit.com/api/v1/marketdata/timeframes",
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://public-api.takeprofit.com/api/v1/marketdata/timeframes"
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://public-api.takeprofit.com/api/v1/marketdata/timeframes")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api.takeprofit.com/api/v1/marketdata/timeframes")
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{
"timeframes": [
{
"id": "1m",
"unit": "MINUTE",
"count": 1,
"label": "1 minute"
},
{
"id": "1h",
"unit": "HOUR",
"count": 1,
"label": "1 hour"
},
{
"id": "1d",
"unit": "DAY",
"count": 1,
"label": "1 day"
},
{
"id": "1M",
"unit": "MONTH",
"count": 1,
"label": "1 month"
}
],
"countRules": [
{
"unit": "MINUTE",
"suffix": "m",
"ranges": [
{
"from": 1,
"to": 1440,
"step": 1
}
]
},
{
"unit": "MONTH",
"suffix": "M",
"ranges": [
{
"from": 1,
"to": 12,
"step": 1
}
]
}
]
}{
"error": {
"code": "invalid_argument",
"message": "query parameter \"exchange\" is required"
}
}{
"error": {
"code": "unauthenticated",
"message": "authentication failed"
}
}{
"error": {
"code": "permission_denied",
"message": "permission denied"
}
}{
"error": {
"code": "rate_limited",
"message": "rate limit exceeded"
}
}Authorizations
Was this page helpful?
⌘I
List supported candle timeframes
curl --request GET \
--url https://public-api.takeprofit.com/api/v1/marketdata/timeframes \
--header 'x-api-key: <api-key>'import requests
url = "https://public-api.takeprofit.com/api/v1/marketdata/timeframes"
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://public-api.takeprofit.com/api/v1/marketdata/timeframes', 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://public-api.takeprofit.com/api/v1/marketdata/timeframes",
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://public-api.takeprofit.com/api/v1/marketdata/timeframes"
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://public-api.takeprofit.com/api/v1/marketdata/timeframes")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api.takeprofit.com/api/v1/marketdata/timeframes")
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{
"timeframes": [
{
"id": "1m",
"unit": "MINUTE",
"count": 1,
"label": "1 minute"
},
{
"id": "1h",
"unit": "HOUR",
"count": 1,
"label": "1 hour"
},
{
"id": "1d",
"unit": "DAY",
"count": 1,
"label": "1 day"
},
{
"id": "1M",
"unit": "MONTH",
"count": 1,
"label": "1 month"
}
],
"countRules": [
{
"unit": "MINUTE",
"suffix": "m",
"ranges": [
{
"from": 1,
"to": 1440,
"step": 1
}
]
},
{
"unit": "MONTH",
"suffix": "M",
"ranges": [
{
"from": 1,
"to": 12,
"step": 1
}
]
}
]
}{
"error": {
"code": "invalid_argument",
"message": "query parameter \"exchange\" is required"
}
}{
"error": {
"code": "unauthenticated",
"message": "authentication failed"
}
}{
"error": {
"code": "permission_denied",
"message": "permission denied"
}
}{
"error": {
"code": "rate_limited",
"message": "rate limit exceeded"
}
}