Skip to main content
POST
/
v1
/
portfolios
/
{portfolio_id}
/
order_preview
Get Order Preview
curl --request POST \
  --url https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/order_preview \
  --header 'Content-Type: application/json' \
  --data '{
  "product_id": "<string>",
  "side": "UNKNOWN_ORDER_SIDE",
  "type": "UNKNOWN_ORDER_TYPE",
  "base_quantity": "<string>",
  "quote_value": "<string>",
  "limit_price": "<string>",
  "start_time": "2023-11-07T05:31:56Z",
  "expiry_time": "2023-11-07T05:31:56Z",
  "time_in_force": "UNKNOWN_TIME_IN_FORCE",
  "is_raise_exact": true,
  "historical_pov": "<string>",
  "stop_price": "<string>",
  "settl_currency": "<string>"
}'
{
  "portfolio_id": "3e1fe27e-26fe-46d8-b118-c752a2ae6b47",
  "product_id": "BTC-USD",
  "side": "UNKNOWN_ORDER_SIDE",
  "type": "UNKNOWN_ORDER_TYPE",
  "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",
  "time_in_force": "UNKNOWN_TIME_IN_FORCE",
  "commission": "4.99",
  "slippage": "0.05",
  "best_bid": "10",
  "best_ask": "10",
  "average_filled_price": "50.19",
  "order_total": "123",
  "historical_pov": "0.5"
}
Use the Prime SDK or CLI to test this endpoint by following the quickstart guide and running with the following examples
  • Java
  • .NET
  • Go
  • Python
  • CLI
  • TS/JS
OrdersService ordersService = PrimeServiceFactory.createOrdersService(client);

GetOrderPreviewRequest request = new GetOrderPreviewRequest.Builder()
    .portfolioId("PORTFOLIO_ID_HERE")
    .productId("ADA-USD")
    .side(OrderSide.BUY)
    .type(OrderType.MARKET)
    .baseQuantity("10.0")
    .build();

GetOrderPreviewResponse orderResponse = ordersService.getOrderPreview(request);
For more information, please visit the Prime Java SDK.

Path Parameters

portfolio_id
string
required

Body

application/json
product_id
string
required
side
enum<string>
default:UNKNOWN_ORDER_SIDE
required
Available options:
UNKNOWN_ORDER_SIDE,
BUY,
SELL
type
enum<string>
default:UNKNOWN_ORDER_TYPE
required
Available options:
UNKNOWN_ORDER_TYPE,
MARKET,
LIMIT,
TWAP,
BLOCK,
VWAP,
STOP_LIMIT,
RFQ
base_quantity
string
quote_value
string
limit_price
string
start_time
string<date-time>
expiry_time
string<date-time>
time_in_force
enum<string>
default:UNKNOWN_TIME_IN_FORCE
Available options:
UNKNOWN_TIME_IN_FORCE,
GOOD_UNTIL_DATE_TIME,
GOOD_UNTIL_CANCELLED,
IMMEDIATE_OR_CANCEL,
FILL_OR_KILL
is_raise_exact
boolean
historical_pov
string
stop_price
string
settl_currency
string

Response

portfolio_id
string
Example:
product_id
string
Example:
side
enum<string>
default:UNKNOWN_ORDER_SIDE
Available options:
UNKNOWN_ORDER_SIDE,
BUY,
SELL
type
enum<string>
default:UNKNOWN_ORDER_TYPE
Available options:
UNKNOWN_ORDER_TYPE,
MARKET,
LIMIT,
TWAP,
BLOCK,
VWAP,
STOP_LIMIT,
RFQ
base_quantity
string
Example:
quote_value
string
Example:
limit_price
string
Example:
start_time
string<date-time>
Example:
expiry_time
string<date-time>
Example:
time_in_force
enum<string>
default:UNKNOWN_TIME_IN_FORCE
Available options:
UNKNOWN_TIME_IN_FORCE,
GOOD_UNTIL_DATE_TIME,
GOOD_UNTIL_CANCELLED,
IMMEDIATE_OR_CANCEL,
FILL_OR_KILL
commission
string
Example:
slippage
string
Example:
best_bid
string
Example:
best_ask
string
Example:
average_filled_price
string
Example:
order_total
string
Example:
historical_pov
string
Example: