List Open Orders
curl --request GET \
--url https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/open_ordersimport requests
url = "https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/open_orders"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/open_orders', 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.prime.coinbase.com/v1/portfolios/{portfolio_id}/open_orders",
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.prime.coinbase.com/v1/portfolios/{portfolio_id}/open_orders"
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.prime.coinbase.com/v1/portfolios/{portfolio_id}/open_orders")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/open_orders")
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{
"orders": [
{
"id": "82c879c1-84e1-44ed-a8c2-1ac239cf09ad",
"user_id": "42",
"portfolio_id": "3e1fe27e-26fe-46d8-b118-c752a2ae6b47",
"product_id": "BTC-USD",
"side": "BUY",
"client_order_id": "f69a20b1-4ac4-420e-90b5-814a12565bfa",
"type": "MARKET",
"base_quantity": "50",
"quote_value": "100",
"limit_price": "50.12",
"start_time": "2021-05-31T09:59:59.000Z",
"expiry_time": "2021-05-31T10:59:59.000Z",
"status": "OPEN",
"time_in_force": "GOOD_UNTIL_DATE_TIME",
"created_at": "2021-05-31T10:59:59.000Z",
"filled_quantity": "100",
"filled_value": "100",
"average_filled_price": "50.19",
"commission": "4.99",
"exchange_fee": "2.50",
"historical_pov": "2.50",
"stop_price": "50.12",
"net_average_filled_price": "57.68",
"user_context": "User initiated cancellation",
"client_product_id": "BTC-USDC",
"post_only": true,
"order_edit_history": [
{
"price": "<string>",
"size": "<string>",
"display_size": "<string>",
"stop_price": "<string>",
"stop_limit_price": "<string>",
"end_time": "2023-11-07T05:31:56Z",
"accept_time": "2023-11-07T05:31:56Z",
"client_order_id": "<string>"
}
],
"is_raise_exact": true,
"display_size": "10.5",
"edit_history": [
{
"price": "100",
"base_quantity": "1",
"quote_value": "100",
"display_base_size": "1.00",
"display_quote_size": "1.00",
"stop_price": "120",
"expiry_time": "2021-05-31T10:59:59.000Z",
"accept_time": "2021-06-20T10:59:59.000Z",
"client_order_id": "123"
}
],
"display_quote_size": "100.50",
"display_base_size": "10.5",
"peg_offset_type": "PEG_OFFSET_TYPE_PRICE",
"offset": "100",
"wig_level": "100000",
"product_type": "SPOT",
"commission_detail_total": {
"total_commission": "<string>",
"client_commission": "<string>",
"venue_commission": "<string>",
"ces_commission": "<string>",
"financing_commission": "<string>",
"regulatory_commission": "<string>",
"clearing_commission": "<string>"
},
"is_buy_exact": false,
"limit_price_type": "LIMIT_PRICE_TYPE_BASE_ASSET",
"spread_details": {
"limit": "<string>",
"limit_type": "SPREAD_LIMIT_TYPE_BPS",
"max_delta_size": "<string>",
"max_delta_type": "MAX_DELTA_TYPE_SPOT",
"group_product_id": "<string>",
"realized_spread": "<string>",
"primary_leg": {
"product_id": "<string>",
"side": "BUY",
"support_passive_order": true,
"filled_quantity": "<string>",
"average_filled_price": "<string>",
"commission": "<string>"
},
"secondary_leg": {
"product_id": "<string>",
"side": "BUY",
"support_passive_order": true,
"filled_quantity": "<string>",
"average_filled_price": "<string>",
"commission": "<string>"
}
}
}
],
"pagination": {
"next_cursor": "<string>",
"sort_direction": "DESC",
"has_next": true
}
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"subcode": "PORTFOLIO_ID_REQUIRED",
"trace_id": "<string>"
}{
"code": "PERMISSION_DENIED",
"message": "<string>",
"subcode": "AUTH_RESOURCE_ACCESS_DENIED",
"trace_id": "<string>"
}{
"code": "RESOURCE_NOT_FOUND",
"message": "<string>",
"subcode": "AUTH_RESOURCE_NOT_FOUND",
"trace_id": "<string>"
}{
"code": "RATE_LIMIT_EXCEEDED",
"message": "<string>",
"subcode": "SERVER_RATE_LIMIT_EXCEEDED",
"trace_id": "<string>"
}{
"code": "SERVICE_UNAVAILABLE",
"message": "<string>",
"subcode": "SERVER_MAINTENANCE_MODE_ACTIVE",
"trace_id": "<string>"
}Orders
List Open Orders
List all open orders.
Caution: The maximum number of orders returned is 5000. If a client has more than 5000 open orders, an error is returned prompting the user to use Websocket API, or FIX API to stream open orders.
GET
/
v1
/
portfolios
/
{portfolio_id}
/
open_orders
List Open Orders
curl --request GET \
--url https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/open_ordersimport requests
url = "https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/open_orders"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/open_orders', 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.prime.coinbase.com/v1/portfolios/{portfolio_id}/open_orders",
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.prime.coinbase.com/v1/portfolios/{portfolio_id}/open_orders"
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.prime.coinbase.com/v1/portfolios/{portfolio_id}/open_orders")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/open_orders")
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{
"orders": [
{
"id": "82c879c1-84e1-44ed-a8c2-1ac239cf09ad",
"user_id": "42",
"portfolio_id": "3e1fe27e-26fe-46d8-b118-c752a2ae6b47",
"product_id": "BTC-USD",
"side": "BUY",
"client_order_id": "f69a20b1-4ac4-420e-90b5-814a12565bfa",
"type": "MARKET",
"base_quantity": "50",
"quote_value": "100",
"limit_price": "50.12",
"start_time": "2021-05-31T09:59:59.000Z",
"expiry_time": "2021-05-31T10:59:59.000Z",
"status": "OPEN",
"time_in_force": "GOOD_UNTIL_DATE_TIME",
"created_at": "2021-05-31T10:59:59.000Z",
"filled_quantity": "100",
"filled_value": "100",
"average_filled_price": "50.19",
"commission": "4.99",
"exchange_fee": "2.50",
"historical_pov": "2.50",
"stop_price": "50.12",
"net_average_filled_price": "57.68",
"user_context": "User initiated cancellation",
"client_product_id": "BTC-USDC",
"post_only": true,
"order_edit_history": [
{
"price": "<string>",
"size": "<string>",
"display_size": "<string>",
"stop_price": "<string>",
"stop_limit_price": "<string>",
"end_time": "2023-11-07T05:31:56Z",
"accept_time": "2023-11-07T05:31:56Z",
"client_order_id": "<string>"
}
],
"is_raise_exact": true,
"display_size": "10.5",
"edit_history": [
{
"price": "100",
"base_quantity": "1",
"quote_value": "100",
"display_base_size": "1.00",
"display_quote_size": "1.00",
"stop_price": "120",
"expiry_time": "2021-05-31T10:59:59.000Z",
"accept_time": "2021-06-20T10:59:59.000Z",
"client_order_id": "123"
}
],
"display_quote_size": "100.50",
"display_base_size": "10.5",
"peg_offset_type": "PEG_OFFSET_TYPE_PRICE",
"offset": "100",
"wig_level": "100000",
"product_type": "SPOT",
"commission_detail_total": {
"total_commission": "<string>",
"client_commission": "<string>",
"venue_commission": "<string>",
"ces_commission": "<string>",
"financing_commission": "<string>",
"regulatory_commission": "<string>",
"clearing_commission": "<string>"
},
"is_buy_exact": false,
"limit_price_type": "LIMIT_PRICE_TYPE_BASE_ASSET",
"spread_details": {
"limit": "<string>",
"limit_type": "SPREAD_LIMIT_TYPE_BPS",
"max_delta_size": "<string>",
"max_delta_type": "MAX_DELTA_TYPE_SPOT",
"group_product_id": "<string>",
"realized_spread": "<string>",
"primary_leg": {
"product_id": "<string>",
"side": "BUY",
"support_passive_order": true,
"filled_quantity": "<string>",
"average_filled_price": "<string>",
"commission": "<string>"
},
"secondary_leg": {
"product_id": "<string>",
"side": "BUY",
"support_passive_order": true,
"filled_quantity": "<string>",
"average_filled_price": "<string>",
"commission": "<string>"
}
}
}
],
"pagination": {
"next_cursor": "<string>",
"sort_direction": "DESC",
"has_next": true
}
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"subcode": "PORTFOLIO_ID_REQUIRED",
"trace_id": "<string>"
}{
"code": "PERMISSION_DENIED",
"message": "<string>",
"subcode": "AUTH_RESOURCE_ACCESS_DENIED",
"trace_id": "<string>"
}{
"code": "RESOURCE_NOT_FOUND",
"message": "<string>",
"subcode": "AUTH_RESOURCE_NOT_FOUND",
"trace_id": "<string>"
}{
"code": "RATE_LIMIT_EXCEEDED",
"message": "<string>",
"subcode": "SERVER_RATE_LIMIT_EXCEEDED",
"trace_id": "<string>"
}{
"code": "SERVICE_UNAVAILABLE",
"message": "<string>",
"subcode": "SERVER_MAINTENANCE_MODE_ACTIVE",
"trace_id": "<string>"
}Use the Prime SDK or CLI to test this endpoint by following the quickstart guide and running with the following examples
For more information, please visit the Prime Java SDK.For more information, please visit the Prime .NET SDK.For more information, please visit the Prime Go SDK.For more information, please visit the Prime Python SDK.For more information, please visit the Prime CLI.For more information, please visit the Prime TS SDK.
- Java
- .NET
- Go
- Python
- CLI
- TS/JS
OrdersService ordersService = PrimeServiceFactory.createOrdersService(client);
ListOpenOrdersRequest request = new ListOpenOrdersRequest.Builder()
.portfolioId("PORTFOLIO_ID_HERE")
.build();
ListOpenOrdersResponse response = ordersService.listOpenOrders(request);
var ordersService = new OrdersService(client);
var request = new ListOpenOrdersRequest("PORTFOLIO_ID_HERE");
var response = ordersService.ListOpenOrders(request);
ordersService := orders.NewOrdersService(client)
request := &orders.ListOpenOrdersRequest{
PortfolioId: "PORTFOLIO_ID_HERE",
}
response, err := ordersService.ListOpenOrders(context.Background(), request)
prime_client = PrimeClient(credentials)
request = ListOpenOrdersRequest(
portfolio_id="PORTFOLIO_ID_HERE",
)
response = prime_client.list_open_orders(request)
primectl list-open-orders --help
const ordersService = new OrdersService(client);
ordersService.listOpenOrders({
portfolioId: 'PORTFOLIO_ID_HERE'
}).then(async (response) => {
console.log('Orders: ', response);
})
Query Parameters
An order type by which to filter the response
- UNKNOWN_ORDER_TYPE: nil value
- MARKET: A market order
- LIMIT: A limit order
- TWAP: A time-weighted average price order
- BLOCK: A block trade
- VWAP: A volume-weighted average price order
- STOP_LIMIT: A conditional order combined of stop order and limit order
- RFQ: A request for quote
- PEG: A pegged order that dynamically adjust based on market conditions while maintaining execution discretion and avoiding adverse selection
- SPREAD: A spread order that trades a futures contract against its spot underlying to capture a target basis (futures price - spot price)
Available options:
MARKET, LIMIT, TWAP, BLOCK, VWAP, STOP_LIMIT, RFQ, PEG, SPREAD Was this page helpful?