Cancel QuickTrade Order
Cancel an active QuickTrade order that has not yet been fully executed. Only orders with status ORDER_STATUS_PENDING
, ORDER_STATUS_ACCEPTED
, or ORDER_STATUS_PARTIALLY_FILLED
can be cancelled. See Order Statuses for a complete reference of all available statuses.
Request URL
DELETE https://ddp.definitive.fi/v2/portfolio/quicktrade/{orderId}
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
orderId | string | Yes | UUID of the order to cancel |
Example
const json = await AuthHelpers.signAndSend({
path: "/v2/portfolio/quicktrade/00000000-0000-0000-0000-000000000001",
method: "DELETE",
apiKey: process.env.API_KEY,
apiSecret: process.env.API_SECRET,
});
console.log(json);
Response
{
success: true,
message: "Order cancelled successfully"
}
Cancellable Order Statuses
QuickTrade orders can be cancelled when they have one of these statuses:
ORDER_STATUS_PENDING
- Order is queued for processingORDER_STATUS_ACCEPTED
- Order is accepted and being processedORDER_STATUS_PARTIALLY_FILLED
- Order is partially executed
Non-Cancellable Order Statuses
Orders cannot be cancelled when they have these statuses:
ORDER_STATUS_FILLED
- Order is completely executedORDER_STATUS_CANCELLED
- Order is already cancelledORDER_STATUS_REJECTED
- Order was rejected by the systemORDER_STATUS_TERMINATED
- Order was terminated
QuickTrade vs Regular Trade Cancellation
QuickTrade cancellation works the same as regular trade cancellation, but with some key differences:
- Speed: QuickTrade orders may execute faster, leaving less time for cancellation
- Atomic execution: QuickTrade orders go through quote-and-execute flow internally
- Higher priority: QuickTrade orders may have higher execution priority
Error Responses
Order Not Found
{
"error": "Order not found",
"code": "ORDER_NOT_FOUND"
}
Order Already Cancelled
{
"error": "Order already cancelled",
"code": "ORDER_ALREADY_CANCELLED"
}
Order Already Filled
{
"error": "Order already filled",
"code": "ORDER_ALREADY_FILLED"
}
Order Cannot Be Cancelled
{
"error": "Order cannot be cancelled",
"code": "ORDER_NOT_CANCELLABLE"
}
Best Practices
- Check order status before attempting cancellation using Get Order Details
- Handle race conditions - orders may fill between status check and cancellation attempt
- Monitor order updates - use webhooks or polling to track order status changes
- Immediate cancellation - cancel as soon as possible if needed, as QuickTrade orders execute quickly
References
Notes
- Cancellations are final and cannot be undone
- Partial fills cannot be reversed - only the remaining quantity can be cancelled
- Network delays may affect cancellation success for fast-executing orders