Historical
curl --request GET \
--url https://api.amberdata.com/markets/futures/open-interest/{instrument} \
--compressed \
--header 'Accept-Encoding: <accept-encoding>' \
--header 'x-api-key: <api-key>'import requests
url = "https://api.amberdata.com/markets/futures/open-interest/{instrument}"
headers = {
"Accept-Encoding": "<accept-encoding>",
"x-api-key": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'Accept-Encoding': '<accept-encoding>', 'x-api-key': '<api-key>'}
};
fetch('https://api.amberdata.com/markets/futures/open-interest/{instrument}', 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.amberdata.com/markets/futures/open-interest/{instrument}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Accept-Encoding: <accept-encoding>",
"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://api.amberdata.com/markets/futures/open-interest/{instrument}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Accept-Encoding", "<accept-encoding>")
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://api.amberdata.com/markets/futures/open-interest/{instrument}")
.header("Accept-Encoding", "<accept-encoding>")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.amberdata.com/markets/futures/open-interest/{instrument}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Accept-Encoding"] = '<accept-encoding>'
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"status": 200,
"title": "OK",
"description": "Successful request",
"payload": {
"metadata": {
"next": "https://api.amberdata.com/markets/futures/open-interest/BTCUSD_PERP?cursor=N4IgpgHgxgFghgOwOZhALhAIwJYMVVAGhCgFcAnAZwHtz0FSAbR4ygFznLYBE43U0ARgDsIgKwAWABwAGCQCYAzMLHEwCACa9%2B6ESIBscidJmDFxXFEakNYAKoJKpAA7Pa-DQFFo8ZGEroAGZwjJRgxGzYALZgAGK0UXzoIFHYzNhhUNSaAcSBCUkYAFY0CCCs7gDSYACeyXoqJgrKYgD6Mq04eAgErQBCACoAwnYAytytAAqeAEqTIAC%2BQA",
"api-version": "2023-09-30"
},
"data": [
{
"instrument": "BTCUSD_PERP",
"exchange": "binance",
"exchangeTimestamp": 1717518065771,
"exchangeTimestampNanoseconds": 0,
"value": 16862174,
"type": "PERPETUAL"
},
{
"instrument": "BTCUSD_PERP",
"exchange": "binance",
"exchangeTimestamp": 1717518157220,
"exchangeTimestampNanoseconds": 0,
"value": 16865368,
"type": "PERPETUAL"
},
{
"instrument": "BTCUSD_PERP",
"exchange": "binance",
"exchangeTimestamp": 1717518218262,
"exchangeTimestampNanoseconds": 0,
"value": 16866686,
"type": "PERPETUAL"
}
]
}
}"{}"Open Interest
Historical
Provides historical open interest data for futures instruments, including timestamps, open interest values, and contract types across exchanges.
GET
/
futures
/
open-interest
/
{instrument}
Historical
curl --request GET \
--url https://api.amberdata.com/markets/futures/open-interest/{instrument} \
--compressed \
--header 'Accept-Encoding: <accept-encoding>' \
--header 'x-api-key: <api-key>'import requests
url = "https://api.amberdata.com/markets/futures/open-interest/{instrument}"
headers = {
"Accept-Encoding": "<accept-encoding>",
"x-api-key": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'Accept-Encoding': '<accept-encoding>', 'x-api-key': '<api-key>'}
};
fetch('https://api.amberdata.com/markets/futures/open-interest/{instrument}', 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.amberdata.com/markets/futures/open-interest/{instrument}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Accept-Encoding: <accept-encoding>",
"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://api.amberdata.com/markets/futures/open-interest/{instrument}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Accept-Encoding", "<accept-encoding>")
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://api.amberdata.com/markets/futures/open-interest/{instrument}")
.header("Accept-Encoding", "<accept-encoding>")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.amberdata.com/markets/futures/open-interest/{instrument}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Accept-Encoding"] = '<accept-encoding>'
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"status": 200,
"title": "OK",
"description": "Successful request",
"payload": {
"metadata": {
"next": "https://api.amberdata.com/markets/futures/open-interest/BTCUSD_PERP?cursor=N4IgpgHgxgFghgOwOZhALhAIwJYMVVAGhCgFcAnAZwHtz0FSAbR4ygFznLYBE43U0ARgDsIgKwAWABwAGCQCYAzMLHEwCACa9%2B6ESIBscidJmDFxXFEakNYAKoJKpAA7Pa-DQFFo8ZGEroAGZwjJRgxGzYALZgAGK0UXzoIFHYzNhhUNSaAcSBCUkYAFY0CCCs7gDSYACeyXoqJgrKYgD6Mq04eAgErQBCACoAwnYAytytAAqeAEqTIAC%2BQA",
"api-version": "2023-09-30"
},
"data": [
{
"instrument": "BTCUSD_PERP",
"exchange": "binance",
"exchangeTimestamp": 1717518065771,
"exchangeTimestampNanoseconds": 0,
"value": 16862174,
"type": "PERPETUAL"
},
{
"instrument": "BTCUSD_PERP",
"exchange": "binance",
"exchangeTimestamp": 1717518157220,
"exchangeTimestampNanoseconds": 0,
"value": 16865368,
"type": "PERPETUAL"
},
{
"instrument": "BTCUSD_PERP",
"exchange": "binance",
"exchangeTimestamp": 1717518218262,
"exchangeTimestampNanoseconds": 0,
"value": 16866686,
"type": "PERPETUAL"
}
]
}
}"{}"The maximum time range (difference between
startDate and endDate) is 731 days (2 years).If the startDate and endDate query parameters are not provided, the API will return the data from the previous 24 hours at the tick granularity.
Path Parameters
Query Parameters
[Optional] Specifies the direction in which the data is sorted (by timestamp). [Defaults] asc (ascending order). [Usage Conditions] This parameter can only be used if the startDate and endDate timeframe is within the most recent 24 hours, or if the startDate and endDate parameters are not used at all. [Examples] ascending | descending | asc | desc
Was this page helpful?