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": "BUY",
"type": "MARKET",
"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": "GOOD_UNTIL_DATE_TIME",
"is_raise_exact": true,
"historical_pov": "<string>",
"stop_price": "<string>",
"settl_currency": "<string>",
"postOnly": true
}'
{
"portfolio_id": "3e1fe27e-26fe-46d8-b118-c752a2ae6b47",
"product_id": "BTC-USD",
"side": "BUY",
"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",
"time_in_force": "GOOD_UNTIL_DATE_TIME",
"commission": "4.99",
"slippage": "0.05",
"best_bid": "10",
"best_ask": "10",
"average_filled_price": "50.19",
"order_total": "123",
"historical_pov": "0.5",
"is_raise_exact": false,
"stop_price": "50000.00",
"display_size": "10.5"
}
Retrieve an 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": "BUY",
"type": "MARKET",
"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": "GOOD_UNTIL_DATE_TIME",
"is_raise_exact": true,
"historical_pov": "<string>",
"stop_price": "<string>",
"settl_currency": "<string>",
"postOnly": true
}'
{
"portfolio_id": "3e1fe27e-26fe-46d8-b118-c752a2ae6b47",
"product_id": "BTC-USD",
"side": "BUY",
"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",
"time_in_force": "GOOD_UNTIL_DATE_TIME",
"commission": "4.99",
"slippage": "0.05",
"best_bid": "10",
"best_ask": "10",
"average_filled_price": "50.19",
"order_total": "123",
"historical_pov": "0.5",
"is_raise_exact": false,
"stop_price": "50000.00",
"display_size": "10.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.
The ID of the portfolio that owns the order
A successful response.
The response is of type object
.
Was this page helpful?