POST
/
v1
/
portfolios
/
{portfolio_id}
/
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

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

The ID of the portfolio that owns the order

Body

application/json

Response

200
application/json

A successful response.

The response is of type object.