Market Data
public/get_tradingview_chart_data
Returns traded-price OHLCV candles for an instrument_name between required start_timestamp and end_timestamp (UTC seconds) at the given period (1m up to 1w), aggregated from executed trade history. Each candle includes open/high/low/close prices plus USD and contract volume, formatted for charting. Public endpoint.
POST
/
public
/
get_tradingview_chart_data
public/get_tradingview_chart_data
curl --request POST \
--url https://api.derive.xyz/v3/public/get_tradingview_chart_data \
--header 'Content-Type: application/json' \
--data '
{
"end_timestamp": 1,
"instrument_name": "<string>",
"period": 1,
"start_timestamp": 1
}
'import requests
url = "https://api.derive.xyz/v3/public/get_tradingview_chart_data"
payload = {
"end_timestamp": 1,
"instrument_name": "<string>",
"period": 1,
"start_timestamp": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({end_timestamp: 1, instrument_name: '<string>', period: 1, start_timestamp: 1})
};
fetch('https://api.derive.xyz/v3/public/get_tradingview_chart_data', 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.derive.xyz/v3/public/get_tradingview_chart_data",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'end_timestamp' => 1,
'instrument_name' => '<string>',
'period' => 1,
'start_timestamp' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.derive.xyz/v3/public/get_tradingview_chart_data"
payload := strings.NewReader("{\n \"end_timestamp\": 1,\n \"instrument_name\": \"<string>\",\n \"period\": 1,\n \"start_timestamp\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.derive.xyz/v3/public/get_tradingview_chart_data")
.header("Content-Type", "application/json")
.body("{\n \"end_timestamp\": 1,\n \"instrument_name\": \"<string>\",\n \"period\": 1,\n \"start_timestamp\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.derive.xyz/v3/public/get_tradingview_chart_data")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"end_timestamp\": 1,\n \"instrument_name\": \"<string>\",\n \"period\": 1,\n \"start_timestamp\": 1\n}"
response = http.request(request)
puts response.read_body[
{
"close_price": "<string>",
"high_price": "<string>",
"low_price": "<string>",
"open_price": "<string>",
"timestamp": 123,
"timestamp_bucket": 123,
"volume_contracts": "<string>",
"volume_usd": "<string>"
}
]Body
application/json
Parameters for public/get_tradingview_chart_data. Numeric fields accept either a JSON number or a string-encoded integer. Timestamps are UTC seconds.
public/get_tradingview_chart_data
curl --request POST \
--url https://api.derive.xyz/v3/public/get_tradingview_chart_data \
--header 'Content-Type: application/json' \
--data '
{
"end_timestamp": 1,
"instrument_name": "<string>",
"period": 1,
"start_timestamp": 1
}
'import requests
url = "https://api.derive.xyz/v3/public/get_tradingview_chart_data"
payload = {
"end_timestamp": 1,
"instrument_name": "<string>",
"period": 1,
"start_timestamp": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({end_timestamp: 1, instrument_name: '<string>', period: 1, start_timestamp: 1})
};
fetch('https://api.derive.xyz/v3/public/get_tradingview_chart_data', 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.derive.xyz/v3/public/get_tradingview_chart_data",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'end_timestamp' => 1,
'instrument_name' => '<string>',
'period' => 1,
'start_timestamp' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.derive.xyz/v3/public/get_tradingview_chart_data"
payload := strings.NewReader("{\n \"end_timestamp\": 1,\n \"instrument_name\": \"<string>\",\n \"period\": 1,\n \"start_timestamp\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.derive.xyz/v3/public/get_tradingview_chart_data")
.header("Content-Type", "application/json")
.body("{\n \"end_timestamp\": 1,\n \"instrument_name\": \"<string>\",\n \"period\": 1,\n \"start_timestamp\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.derive.xyz/v3/public/get_tradingview_chart_data")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"end_timestamp\": 1,\n \"instrument_name\": \"<string>\",\n \"period\": 1,\n \"start_timestamp\": 1\n}"
response = http.request(request)
puts response.read_body[
{
"close_price": "<string>",
"high_price": "<string>",
"low_price": "<string>",
"open_price": "<string>",
"timestamp": 123,
"timestamp_bucket": 123,
"volume_contracts": "<string>",
"volume_usd": "<string>"
}
]