Get product ticker
curl --request GET \
--url https://api.exchange.coinbase.com/products/{product_id}/tickerimport requests
url = "https://api.exchange.coinbase.com/products/{product_id}/ticker"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.exchange.coinbase.com/products/{product_id}/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://api.exchange.coinbase.com/products/{product_id}/ticker",
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://api.exchange.coinbase.com/products/{product_id}/ticker"
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://api.exchange.coinbase.com/products/{product_id}/ticker")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exchange.coinbase.com/products/{product_id}/ticker")
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{
"trade_id": 86326522,
"price": "6268.48",
"size": "0.00698254",
"time": "2020-03-20T00:22:57.833Z",
"bid": "6265.15",
"ask": "6267.71",
"volume": "53602.03940154",
"rfq_volume": "123.122",
"conversions_volume": "0.00"
}{
"message": "<string>"
}Products
Get product ticker
Gets snapshot information about the last trade (tick), best bid/ask and 24h volume.
GET
/
products
/
{product_id}
/
ticker
Get product ticker
curl --request GET \
--url https://api.exchange.coinbase.com/products/{product_id}/tickerimport requests
url = "https://api.exchange.coinbase.com/products/{product_id}/ticker"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.exchange.coinbase.com/products/{product_id}/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://api.exchange.coinbase.com/products/{product_id}/ticker",
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://api.exchange.coinbase.com/products/{product_id}/ticker"
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://api.exchange.coinbase.com/products/{product_id}/ticker")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exchange.coinbase.com/products/{product_id}/ticker")
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{
"trade_id": 86326522,
"price": "6268.48",
"size": "0.00698254",
"time": "2020-03-20T00:22:57.833Z",
"bid": "6265.15",
"ask": "6267.71",
"volume": "53602.03940154",
"rfq_volume": "123.122",
"conversions_volume": "0.00"
}{
"message": "<string>"
}Real-time updates
Coinbase recommends that you get real-time updates by connecting with the WebSocket stream and listening for match messages, rather than polling.Was this page helpful?
⌘I