Skip to content

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

ParameterTypeRequiredDescription
orderIdstringYesUUID 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 processing
  • ORDER_STATUS_ACCEPTED - Order is accepted and being processed
  • ORDER_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 executed
  • ORDER_STATUS_CANCELLED - Order is already cancelled
  • ORDER_STATUS_REJECTED - Order was rejected by the system
  • ORDER_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

  1. Check order status before attempting cancellation using Get Order Details
  2. Handle race conditions - orders may fill between status check and cancellation attempt
  3. Monitor order updates - use webhooks or polling to track order status changes
  4. 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