cURL
curl --request GET \
--url https://drb.coinbase.com/api/v2/public/ticker \
--header 'Content-Type: application/json' \
--data '
{
"id": 8106,
"jsonrpc": "2.0",
"method": "public/ticker",
"params": {
"instrument_name": "BTC-PERPETUAL"
}
}
'import requests
url = "https://drb.coinbase.com/api/v2/public/ticker"
payload = {
"id": 8106,
"jsonrpc": "2.0",
"method": "public/ticker",
"params": { "instrument_name": "BTC-PERPETUAL" }
}
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: 8106,
jsonrpc: '2.0',
method: 'public/ticker',
params: {instrument_name: 'BTC-PERPETUAL'}
})
};
fetch('https://drb.coinbase.com/api/v2/public/ticker', 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/public/ticker",
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' => 8106,
'jsonrpc' => '2.0',
'method' => 'public/ticker',
'params' => [
'instrument_name' => 'BTC-PERPETUAL'
]
]),
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/public/ticker"
payload := strings.NewReader("{\n \"id\": 8106,\n \"jsonrpc\": \"2.0\",\n \"method\": \"public/ticker\",\n \"params\": {\n \"instrument_name\": \"BTC-PERPETUAL\"\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/public/ticker")
.header("Content-Type", "application/json")
.body("{\n \"id\": 8106,\n \"jsonrpc\": \"2.0\",\n \"method\": \"public/ticker\",\n \"params\": {\n \"instrument_name\": \"BTC-PERPETUAL\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://drb.coinbase.com/api/v2/public/ticker")
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\": 8106,\n \"jsonrpc\": \"2.0\",\n \"method\": \"public/ticker\",\n \"params\": {\n \"instrument_name\": \"BTC-PERPETUAL\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 8106,
"jsonrpc": "2.0",
"result": {
"best_ask_amount": 53040,
"best_ask_price": 36290,
"best_bid_amount": 4600,
"best_bid_price": 36289.5,
"current_funding": 0,
"estimated_delivery_price": 36297.02,
"funding_8h": 0.00002203,
"index_price": 36297.02,
"instrument_name": "BTC-PERPETUAL",
"interest_value": 1.7362511643080387,
"last_price": 36289.5,
"mark_price": 36288.31,
"max_price": 36833.4,
"min_price": 35744.73,
"open_interest": 502231260,
"settlement_price": 36169.49,
"state": "open",
"stats": {
"high": 36824.5,
"low": 35213.5,
"price_change": 0.2362,
"volume": 7831.26548117,
"volume_usd": 282615600
},
"timestamp": 1623059681955
}
}Market Data
public/ticker
Retrieves the ticker (24-hour statistics) for a specific instrument. The ticker includes the last trade price, best bid/ask prices, 24-hour high/low, 24-hour volume, open interest, mark price, and other market statistics.
This is a lightweight method for getting current market data for a single instrument. For real-time updates, consider using WebSocket subscriptions to ticker channels.
GET
/
public
/
ticker
cURL
curl --request GET \
--url https://drb.coinbase.com/api/v2/public/ticker \
--header 'Content-Type: application/json' \
--data '
{
"id": 8106,
"jsonrpc": "2.0",
"method": "public/ticker",
"params": {
"instrument_name": "BTC-PERPETUAL"
}
}
'import requests
url = "https://drb.coinbase.com/api/v2/public/ticker"
payload = {
"id": 8106,
"jsonrpc": "2.0",
"method": "public/ticker",
"params": { "instrument_name": "BTC-PERPETUAL" }
}
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: 8106,
jsonrpc: '2.0',
method: 'public/ticker',
params: {instrument_name: 'BTC-PERPETUAL'}
})
};
fetch('https://drb.coinbase.com/api/v2/public/ticker', 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/public/ticker",
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' => 8106,
'jsonrpc' => '2.0',
'method' => 'public/ticker',
'params' => [
'instrument_name' => 'BTC-PERPETUAL'
]
]),
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/public/ticker"
payload := strings.NewReader("{\n \"id\": 8106,\n \"jsonrpc\": \"2.0\",\n \"method\": \"public/ticker\",\n \"params\": {\n \"instrument_name\": \"BTC-PERPETUAL\"\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/public/ticker")
.header("Content-Type", "application/json")
.body("{\n \"id\": 8106,\n \"jsonrpc\": \"2.0\",\n \"method\": \"public/ticker\",\n \"params\": {\n \"instrument_name\": \"BTC-PERPETUAL\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://drb.coinbase.com/api/v2/public/ticker")
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\": 8106,\n \"jsonrpc\": \"2.0\",\n \"method\": \"public/ticker\",\n \"params\": {\n \"instrument_name\": \"BTC-PERPETUAL\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 8106,
"jsonrpc": "2.0",
"result": {
"best_ask_amount": 53040,
"best_ask_price": 36290,
"best_bid_amount": 4600,
"best_bid_price": 36289.5,
"current_funding": 0,
"estimated_delivery_price": 36297.02,
"funding_8h": 0.00002203,
"index_price": 36297.02,
"instrument_name": "BTC-PERPETUAL",
"interest_value": 1.7362511643080387,
"last_price": 36289.5,
"mark_price": 36288.31,
"max_price": 36833.4,
"min_price": 35744.73,
"open_interest": 502231260,
"settlement_price": 36169.49,
"state": "open",
"stats": {
"high": 36824.5,
"low": 35213.5,
"price_change": 0.2362,
"volume": 7831.26548117,
"volume_usd": 282615600
},
"timestamp": 1623059681955
}
}Query Parameters
Instrument name Unique instrument identifier
Example:
"BTC-PERPETUAL"
Was this page helpful?
⌘I