Skip to main content
cURL
curl --request GET \
  --url https://test.deribit.com/api/v2/public/get_order_book_by_instrument_id
import requests

url = "https://test.deribit.com/api/v2/public/get_order_book_by_instrument_id"

response = requests.get(url)

print(response.text)
const options = {method: 'GET'};

fetch('https://test.deribit.com/api/v2/public/get_order_book_by_instrument_id', 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://test.deribit.com/api/v2/public/get_order_book_by_instrument_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);

$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://test.deribit.com/api/v2/public/get_order_book_by_instrument_id"

req, _ := http.NewRequest("GET", url, nil)

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://test.deribit.com/api/v2/public/get_order_book_by_instrument_id")
.asString();
require 'uri'
require 'net/http'

url = URI("https://test.deribit.com/api/v2/public/get_order_book_by_instrument_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
{
  "jsonrpc": "2.0",
  "id": 8772,
  "result": {
    "timestamp": 1550757626706,
    "stats": {
      "volume": 93.35589552,
      "price_change": 0.6913,
      "low": 3940.75,
      "high": 3976.25
    },
    "state": "open",
    "settlement_price": 3925.85,
    "open_interest": 45.27600333464605,
    "min_price": 3932.22,
    "max_price": 3971.74,
    "mark_price": 3931.97,
    "last_price": 3955.75,
    "instrument_name": "BTC-PERPETUAL",
    "index_price": 3910.46,
    "funding_8h": 0.00455263,
    "current_funding": 0.00500063,
    "change_id": 474988,
    "bids": [
      [
        3955.75,
        30
      ],
      [
        3940.75,
        102020
      ],
      [
        3423,
        42840
      ]
    ],
    "best_bid_price": 3955.75,
    "best_bid_amount": 30,
    "best_ask_price": 0,
    "best_ask_amount": 0,
    "asks": []
  }
}

Query Parameters

instrument_id
integer
required

The instrument ID for which to retrieve the order book, see public/get_instruments to obtain instrument IDs.

depth
enum<integer>

The number of entries to return for bids and asks, maximum - 10000.

Available options:
1,
5,
10,
20,
50,
100,
1000,
10000

Response

200 - application/json

Success response

jsonrpc
enum<string>
required

The JSON-RPC version (2.0)

Available options:
2.0
result
object
required
id
integer

The id that was sent in the request