curl --request GET \
--url https://api.amberdata.com/markets/spot/order-book-snapshots/{instrument} \
--compressed \
--header 'Accept-Encoding: <accept-encoding>' \
--header 'x-api-key: <api-key>'import requests
url = "https://api.amberdata.com/markets/spot/order-book-snapshots/{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/spot/order-book-snapshots/{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/spot/order-book-snapshots/{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/spot/order-book-snapshots/{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/spot/order-book-snapshots/{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/spot/order-book-snapshots/{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": {
"requestedStartDate": 1717513062160,
"requestedEndDate": 1717599462160,
"returnedStartDate": 1717513080000,
"returnedEndDate": 1717515360000,
"next": "https://api.amberdata.com/markets/spot/order-book-snapshots/eth_usd?cursor=N4IgxgrgTgzg9lEAuAdhANugNCGAXAQyjwBEC8BTZARgHY6BWahgZgDYAGLjnClAEzKUa9WgwCc4gCxsATNU448ASwC2FAGIJV5ZCFXLMymBTBwBMEErUUAkikpQAbgXTJQKAur0BPCkUscGABHdAA5LyokED8iK1xQiPUABXRoV19-KHQfeP4KADMCDDxkAA42KW4uHB0AD2Q2FlkpKTLqnhB0ODgAawAjAjBe5IooZTh%2BZDRMAF8cAu1daIAreBR4ijqwAAsCFABzKJB%2B5TwC5RQt%2BJV1fC8AB2mMbH0COoAZCicKN1QXoIIPAAaQouWidEYzHY1QA%2BhxYadzpctvDYXgoBAKLCKHgdrCIDAprMgA",
"api-version": "2023-09-30"
},
"data": [
{
"exchange": "bitfinex",
"instrument": "eth_usd",
"timestamp": 1717513080000,
"sequence": null,
"ask": [
{
"price": 3780.7,
"volume": 7.33,
"numOrders": 1
},
{
"price": 3780.8,
"volume": 11.60410568,
"numOrders": 1
}
]
}
]
}
}Snapshots Historical
Delivers historical order book snapshots for specified Spot market trading pairs, including detailed bid and ask levels, volume, and order count per price level, along with timestamps to track market depth over time.
curl --request GET \
--url https://api.amberdata.com/markets/spot/order-book-snapshots/{instrument} \
--compressed \
--header 'Accept-Encoding: <accept-encoding>' \
--header 'x-api-key: <api-key>'import requests
url = "https://api.amberdata.com/markets/spot/order-book-snapshots/{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/spot/order-book-snapshots/{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/spot/order-book-snapshots/{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/spot/order-book-snapshots/{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/spot/order-book-snapshots/{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/spot/order-book-snapshots/{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": {
"requestedStartDate": 1717513062160,
"requestedEndDate": 1717599462160,
"returnedStartDate": 1717513080000,
"returnedEndDate": 1717515360000,
"next": "https://api.amberdata.com/markets/spot/order-book-snapshots/eth_usd?cursor=N4IgxgrgTgzg9lEAuAdhANugNCGAXAQyjwBEC8BTZARgHY6BWahgZgDYAGLjnClAEzKUa9WgwCc4gCxsATNU448ASwC2FAGIJV5ZCFXLMymBTBwBMEErUUAkikpQAbgXTJQKAur0BPCkUscGABHdAA5LyokED8iK1xQiPUABXRoV19-KHQfeP4KADMCDDxkAA42KW4uHB0AD2Q2FlkpKTLqnhB0ODgAawAjAjBe5IooZTh%2BZDRMAF8cAu1daIAreBR4ijqwAAsCFABzKJB%2B5TwC5RQt%2BJV1fC8AB2mMbH0COoAZCicKN1QXoIIPAAaQouWidEYzHY1QA%2BhxYadzpctvDYXgoBAKLCKHgdrCIDAprMgA",
"api-version": "2023-09-30"
},
"data": [
{
"exchange": "bitfinex",
"instrument": "eth_usd",
"timestamp": 1717513080000,
"sequence": null,
"ask": [
{
"price": 3780.7,
"volume": 7.33,
"numOrders": 1
},
{
"price": 3780.8,
"volume": 11.60410568,
"numOrders": 1
}
]
}
]
}
}BitMEX Volume Calculation Warning
BitMEX Volume Calculation Warning
volume field represents the number of contracts traded, not the volume in the base asset.To obtain the correct volume, users must adjust for contract size using the underlyingToPositionMultiplier from our Reference endpoint.For details on this calculation and how to retrieve the correct values, see our Changelog Update.startDate and endDate) is 18 months.startDate and endDate query parameters are not provided, the API will return the data from the previous 24 hours.Authorizations
Path Parameters
The spot instrument for which data will be retrieved.
Query Parameters
The exchange for which data should be retrieved. Only 1 exchange is allowed.
[Optional] Payload only includes data after this date (inclusive). [Formats] seconds | milliseconds | iso8601 [Examples] 1578531600 | 1578531600000 | 2020-09-01T01:00:00
[Optional] Payload only includes data before this date (exclusive). [Formats] seconds | milliseconds | iso8601 [Examples] 1578531600 | 1578531600000 | 2020-09-01T01:00:00
The number of order book levels that should be returned. By default, returns max available levels.
[Optional] The timestamp at which to return the order book information (closest match, lower or equal to the timestamp specified).
[Optional] Time format of the timestamps in the response.
milliseconds, ms*, iso, iso8601, hr, human_readable [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?