Submit Order
Submits a trade order using a previously obtained quote. The order will be executed according to the quote parameters and current market conditions.
Request URL
POST https://ddp.definitive.fi/v2/organization/portfolios/{portfolioId}/trade
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
portfolioId | string | Yes | UUID of the portfolio |
Request Body
Field | Type | Required | Description |
---|---|---|---|
externalOrderRequest | object | Yes | Original order request (without quote details) |
quoteId | string | Yes | Quote ID from the quote response |
Example
// First, request a quote
const quoteResponse = await AuthHelpers.signAndSend({
path: "/v2/organization/portfolios/00000000-0000-0000-0000-000000000001/trade/quote",
method: "POST",
body: {
type: "market",
chain: "ethereum",
targetAsset: "...",
contraAsset: "...",
qty: "1000",
orderSide: "buy",
slippageTolerance: "0.01",
maxPriceImpact: "0.01"
},
apiKey: process.env.API_KEY,
apiSecret: process.env.API_SECRET,
});
// Extract the quote ID and original order request
const { quote: quoteDetails, ...externalOrderRequest } = quoteResponse;
const quoteId = quoteDetails.id;
// Then, submit the order
const orderResponse = await AuthHelpers.signAndSend({
path: "/v2/organization/portfolios/00000000-0000-0000-0000-000000000001/trade",
method: "POST",
body: {
externalOrderRequest,
quoteId
},
apiKey: process.env.API_KEY,
apiSecret: process.env.API_SECRET,
});
console.log(orderResponse);
Response
{
"orderId": "00000000-0000-0000-0000-000000000005"
}
Notes
- Quotes are short-lived and should be submitted immediately
- If the quote expires or market conditions change, submission may fail
- The
externalOrderRequest
should be the original order request without the quote details - The
quoteId
is found in thequote.id
field of the quote response
Order Status
After submission, orders may move through the following statuses:
Status | Description |
---|---|
submitted | Order has been received and is being processed |
pending | Order is waiting for execution conditions |
partially_filled | Some of the order has been executed |
filled | The order has been fully executed |
cancelled | The order was cancelled (manually or system-triggered) |
failed | Execution failed due to price impact, slippage, or technical error |
expired | The order expired before execution |