cURL
curl --request GET \
--url https://drb.coinbase.com/api/v2/private/get_leg_prices \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "private/get_leg_prices",
"params": {
"legs": [
{
"amount": 2,
"direction": "buy",
"instrument_name": "BTC-1NOV24-67000-C"
},
{
"amount": 2,
"direction": "sell",
"instrument_name": "BTC-1NOV24-66000-C"
}
],
"price": 0.6
}
}
'import requests
url = "https://drb.coinbase.com/api/v2/private/get_leg_prices"
payload = {
"id": 1,
"jsonrpc": "2.0",
"method": "private/get_leg_prices",
"params": {
"legs": [
{
"amount": 2,
"direction": "buy",
"instrument_name": "BTC-1NOV24-67000-C"
},
{
"amount": 2,
"direction": "sell",
"instrument_name": "BTC-1NOV24-66000-C"
}
],
"price": 0.6
}
}
headers = {"Content-Type": "application/json"}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: 1,
jsonrpc: '2.0',
method: 'private/get_leg_prices',
params: {
legs: [
{amount: 2, direction: 'buy', instrument_name: 'BTC-1NOV24-67000-C'},
{amount: 2, direction: 'sell', instrument_name: 'BTC-1NOV24-66000-C'}
],
price: 0.6
}
})
};
fetch('https://drb.coinbase.com/api/v2/private/get_leg_prices', 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://drb.coinbase.com/api/v2/private/get_leg_prices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'id' => 1,
'jsonrpc' => '2.0',
'method' => 'private/get_leg_prices',
'params' => [
'legs' => [
[
'amount' => 2,
'direction' => 'buy',
'instrument_name' => 'BTC-1NOV24-67000-C'
],
[
'amount' => 2,
'direction' => 'sell',
'instrument_name' => 'BTC-1NOV24-66000-C'
]
],
'price' => 0.6
]
]),
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://drb.coinbase.com/api/v2/private/get_leg_prices"
payload := strings.NewReader("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"private/get_leg_prices\",\n \"params\": {\n \"legs\": [\n {\n \"amount\": 2,\n \"direction\": \"buy\",\n \"instrument_name\": \"BTC-1NOV24-67000-C\"\n },\n {\n \"amount\": 2,\n \"direction\": \"sell\",\n \"instrument_name\": \"BTC-1NOV24-66000-C\"\n }\n ],\n \"price\": 0.6\n }\n}")
req, _ := http.NewRequest("GET", 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.get("https://drb.coinbase.com/api/v2/private/get_leg_prices")
.header("Content-Type", "application/json")
.body("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"private/get_leg_prices\",\n \"params\": {\n \"legs\": [\n {\n \"amount\": 2,\n \"direction\": \"buy\",\n \"instrument_name\": \"BTC-1NOV24-67000-C\"\n },\n {\n \"amount\": 2,\n \"direction\": \"sell\",\n \"instrument_name\": \"BTC-1NOV24-66000-C\"\n }\n ],\n \"price\": 0.6\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://drb.coinbase.com/api/v2/private/get_leg_prices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"private/get_leg_prices\",\n \"params\": {\n \"legs\": [\n {\n \"amount\": 2,\n \"direction\": \"buy\",\n \"instrument_name\": \"BTC-1NOV24-67000-C\"\n },\n {\n \"amount\": 2,\n \"direction\": \"sell\",\n \"instrument_name\": \"BTC-1NOV24-66000-C\"\n }\n ],\n \"price\": 0.6\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"jsonrpc": "2.0",
"result": {
"amount": 2,
"legs": [
{
"direction": "buy",
"instrument_name": "BTC-1NOV24-67000-C",
"price": 0.6001,
"ratio": 1
},
{
"direction": "sell",
"instrument_name": "BTC-1NOV24-66000-C",
"price": 0.0001,
"ratio": 1
}
]
}
}Combo Books
private/get_leg_prices
Returns individual leg prices for a given combo structure based on an aggregated price of the strategy and the mark prices of the individual legs.
Note: Leg prices change dynamically with mark price fluctuations, and the algorithm is calibrated only for conventional option structures and future spreads. This method supports both inverse strategies and known linear structures within a single currency pair.
Scope: rat#view or wallet:user:read
GET
/
private
/
get_leg_prices
cURL
curl --request GET \
--url https://drb.coinbase.com/api/v2/private/get_leg_prices \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "private/get_leg_prices",
"params": {
"legs": [
{
"amount": 2,
"direction": "buy",
"instrument_name": "BTC-1NOV24-67000-C"
},
{
"amount": 2,
"direction": "sell",
"instrument_name": "BTC-1NOV24-66000-C"
}
],
"price": 0.6
}
}
'import requests
url = "https://drb.coinbase.com/api/v2/private/get_leg_prices"
payload = {
"id": 1,
"jsonrpc": "2.0",
"method": "private/get_leg_prices",
"params": {
"legs": [
{
"amount": 2,
"direction": "buy",
"instrument_name": "BTC-1NOV24-67000-C"
},
{
"amount": 2,
"direction": "sell",
"instrument_name": "BTC-1NOV24-66000-C"
}
],
"price": 0.6
}
}
headers = {"Content-Type": "application/json"}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: 1,
jsonrpc: '2.0',
method: 'private/get_leg_prices',
params: {
legs: [
{amount: 2, direction: 'buy', instrument_name: 'BTC-1NOV24-67000-C'},
{amount: 2, direction: 'sell', instrument_name: 'BTC-1NOV24-66000-C'}
],
price: 0.6
}
})
};
fetch('https://drb.coinbase.com/api/v2/private/get_leg_prices', 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://drb.coinbase.com/api/v2/private/get_leg_prices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'id' => 1,
'jsonrpc' => '2.0',
'method' => 'private/get_leg_prices',
'params' => [
'legs' => [
[
'amount' => 2,
'direction' => 'buy',
'instrument_name' => 'BTC-1NOV24-67000-C'
],
[
'amount' => 2,
'direction' => 'sell',
'instrument_name' => 'BTC-1NOV24-66000-C'
]
],
'price' => 0.6
]
]),
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://drb.coinbase.com/api/v2/private/get_leg_prices"
payload := strings.NewReader("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"private/get_leg_prices\",\n \"params\": {\n \"legs\": [\n {\n \"amount\": 2,\n \"direction\": \"buy\",\n \"instrument_name\": \"BTC-1NOV24-67000-C\"\n },\n {\n \"amount\": 2,\n \"direction\": \"sell\",\n \"instrument_name\": \"BTC-1NOV24-66000-C\"\n }\n ],\n \"price\": 0.6\n }\n}")
req, _ := http.NewRequest("GET", 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.get("https://drb.coinbase.com/api/v2/private/get_leg_prices")
.header("Content-Type", "application/json")
.body("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"private/get_leg_prices\",\n \"params\": {\n \"legs\": [\n {\n \"amount\": 2,\n \"direction\": \"buy\",\n \"instrument_name\": \"BTC-1NOV24-67000-C\"\n },\n {\n \"amount\": 2,\n \"direction\": \"sell\",\n \"instrument_name\": \"BTC-1NOV24-66000-C\"\n }\n ],\n \"price\": 0.6\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://drb.coinbase.com/api/v2/private/get_leg_prices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"private/get_leg_prices\",\n \"params\": {\n \"legs\": [\n {\n \"amount\": 2,\n \"direction\": \"buy\",\n \"instrument_name\": \"BTC-1NOV24-67000-C\"\n },\n {\n \"amount\": 2,\n \"direction\": \"sell\",\n \"instrument_name\": \"BTC-1NOV24-66000-C\"\n }\n ],\n \"price\": 0.6\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"jsonrpc": "2.0",
"result": {
"amount": 2,
"legs": [
{
"direction": "buy",
"instrument_name": "BTC-1NOV24-67000-C",
"price": 0.6001,
"ratio": 1
},
{
"direction": "sell",
"instrument_name": "BTC-1NOV24-66000-C",
"price": 0.0001,
"ratio": 1
}
]
}
}Query Parameters
List of legs for which the prices will be calculated
Show child attributes
Show child attributes
Price for the whole leg structure
Was this page helpful?
⌘I