curl --request GET \
--url https://api.blockworks.com/query/timeseries/perpetual-markets/{granularity} \
--header 'X-Blockworks-API-Key: <api-key>'import requests
url = "https://api.blockworks.com/query/timeseries/perpetual-markets/{granularity}"
headers = {"X-Blockworks-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Blockworks-API-Key': '<api-key>'}};
fetch('https://api.blockworks.com/query/timeseries/perpetual-markets/{granularity}', 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.blockworks.com/query/timeseries/perpetual-markets/{granularity}",
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-Blockworks-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.blockworks.com/query/timeseries/perpetual-markets/{granularity}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Blockworks-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.blockworks.com/query/timeseries/perpetual-markets/{granularity}")
.header("X-Blockworks-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.blockworks.com/query/timeseries/perpetual-markets/{granularity}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Blockworks-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"point_schema": [
{
"description": "<string>",
"field": "<string>",
"name": "<string>",
"time": true,
"type": "<string>",
"unit": "usd"
}
],
"series": [
{
"entity": {
"baseAssetName": "<string>",
"baseAssetSymbol": "<string>",
"exchange": "<string>",
"name": "<string>",
"quoteCurrency": "<string>",
"symbol": "<string>"
},
"key": "<string>",
"points": [
[
123
]
]
}
]
},
"error": "<string>"
}{
"data": null,
"error": "too many series requested: 11 exceeds the maximum of 10"
}{
"data": null,
"error": "this model requires authentication"
}{
"data": null,
"error": "this model requires the \"market_data_unified\" permission"
}{
"data": null,
"error": "the all-series endpoint is not available for model \"perpetual-markets\"; request specific series via ?series or a series-key path"
}Batch Get Perpetual Market timeseries
Price, volume and open interest for a perpetual futures contract on a centralized exchange: open, high, low, close, volume and end-of-day and average open interest. Each series is one contract, keyed by exchange and contract symbol. Dated futures are not included.
curl --request GET \
--url https://api.blockworks.com/query/timeseries/perpetual-markets/{granularity} \
--header 'X-Blockworks-API-Key: <api-key>'import requests
url = "https://api.blockworks.com/query/timeseries/perpetual-markets/{granularity}"
headers = {"X-Blockworks-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Blockworks-API-Key': '<api-key>'}};
fetch('https://api.blockworks.com/query/timeseries/perpetual-markets/{granularity}', 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.blockworks.com/query/timeseries/perpetual-markets/{granularity}",
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-Blockworks-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.blockworks.com/query/timeseries/perpetual-markets/{granularity}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Blockworks-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.blockworks.com/query/timeseries/perpetual-markets/{granularity}")
.header("X-Blockworks-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.blockworks.com/query/timeseries/perpetual-markets/{granularity}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Blockworks-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"point_schema": [
{
"description": "<string>",
"field": "<string>",
"name": "<string>",
"time": true,
"type": "<string>",
"unit": "usd"
}
],
"series": [
{
"entity": {
"baseAssetName": "<string>",
"baseAssetSymbol": "<string>",
"exchange": "<string>",
"name": "<string>",
"quoteCurrency": "<string>",
"symbol": "<string>"
},
"key": "<string>",
"points": [
[
123
]
]
}
]
},
"error": "<string>"
}{
"data": null,
"error": "too many series requested: 11 exceeds the maximum of 10"
}{
"data": null,
"error": "this model requires authentication"
}{
"data": null,
"error": "this model requires the \"market_data_unified\" permission"
}{
"data": null,
"error": "the all-series endpoint is not available for model \"perpetual-markets\"; request specific series via ?series or a series-key path"
}Authorizations
API key sent in the X-Blockworks-API-Key header; x-messari-api-key is accepted for existing integrations. The catalog endpoints and models on the public access tier need no key.
Path Parameters
Data granularity.
1d Query Parameters
Comma-separated Perpetual Market ID values naming the series to return (up to 10). Required: this model has too many series to return at once.
Time window, one of: to-date (ytd, qtd, mtd, dtd, htd); relative, followed by m, h, d or w (30d, 12h, 4w; 1y and 1M are not accepted, use 365d, 52w, ytd or a calendar year); a calendar day (YYYY-MM-DD), month (YYYY-MM) or year (YYYY); or an RFC3339 instant, which runs from then to now. Mutually exclusive with start/end. Default: everything retained, up to now.
Window start, inclusive (RFC3339, unix seconds, or YYYY-MM-DD). Default: unbounded.
Window end, exclusive (RFC3339, unix seconds, or YYYY-MM-DD). Default: now.
If true, return only the first and last point of the resolved time window instead of every point in it.
Comma-separated metric fields to return; defaults to every metric. A point always leads with its timestamp, and the values that follow are described by point_schema in catalog order regardless of the order requested here.
openPrice, highPrice, lowPrice, closePrice, closePricePerUnit, volumeUSD, openInterestUSD, openInterestUSDAvg Response format, overriding the Accept header: json (default), csv, or jsonl (NDJSON). csv and jsonl return the rows as a downloadable file.
json, csv, jsonl