Skip to main content

POST Cancel All Orders

Cancel all open orders across all accounts NT8

Cancels every working order across all connected NT8 accounts.

Endpoint

POST /v1/api/orders/cancelall

Headers

NameValue
Content-Typeapplication/json
AuthorizationBearer <token>

Code examples

import requests

token = 'my-secret-token'

url = "https://app.crosstrade.io/v1/api/orders/cancelall"
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
data = {}

try:
response = requests.post(url, headers=headers, json=data)
print(f"Response Code: {response.status_code}, Response Text: {response.text}")
except Exception as e:
print(f"An error occurred: {e}")

Response

{
"orderIds": [
"ddc3f4c244b047fda3f4d9f8f44bc8f3",
"b415488f31ff454682a947684e871a90",
"179b24c22fbd47e98b95b63c8ebd6aa4",
"68d01307c4bf4a6382bb863b42748a28",
"148230092d2144f4b0efa686bf6cb515",
"37101553a8ab466eb2f4f3b138954317",
"2ff65c7460b042da98d5e2936d5a3314",
"46feaed8d96e4261bb0b65fb3f04e417",
"78a571a7ebd9470e8b36af4cbf49809f",
"cfb62ddf171f4e6c9f7ac65939845ea1"
],
"success": true
}

Platform nuances

  • This endpoint has no account or instrument filter. It iterates every loaded NT8 account and submits every nonterminal order for cancellation.
  • Open positions are not flattened.
  • orderIds lists the orders submitted for cancellation; the method does not wait for each cancellation to reach a terminal state before returning.

WebSocket API

This request can also be made over the WebSocket API.

{
"action": "rpc",
"id": "my-request-id",
"api": "CancelAllOrders",
"args": {}
}