Skip to content

CancelGTTOrder

Cancel an active GTT trigger by its trigger_id. Cancelling an OCO removes both legs atomically.

Endpoint URL

http
Local Host   :  POST http://127.0.0.1:5000/api/v1/cancelgttorder
Ngrok Domain :  POST https://<your-ngrok-domain>.ngrok-free.app/api/v1/cancelgttorder
Custom Domain:  POST https://<your-custom-domain>/api/v1/cancelgttorder

Sample API Request

json
{
  "apikey": "<your_app_apikey>",
  "strategy": "My GTT Strategy",
  "trigger_id": "23132604291205"
}

Sample cURL Request

bash
curl -X POST http://127.0.0.1:5000/api/v1/cancelgttorder \
  -H 'Content-Type: application/json' \
  -d '{
  "apikey": "<your_app_apikey>",
  "strategy": "My GTT Strategy",
  "trigger_id": "23132604291205"
}'

Sample API Response

json
{
  "status": "success",
  "trigger_id": "23132604291205"
}

Request Body

ParameterDescriptionMandatory/OptionalDefault Value
apikeyYour Tradeboard API keyMandatory-
strategyStrategy identifier (used in event logs)Mandatory-
trigger_idActive trigger ID returned by PlaceGTTOrderMandatory-

CancelGTTOrderSchema declares exactly these three fields and all three are required. Unlike the GTT place and modify schemas, it does not drop unknown fields: any additional key returns HTTP 400.

Response Fields

FieldTypeDescription
statusstring"success" or "error"
trigger_idstringCancelled trigger ID
messagestringError message (on failure)

Notes

  • Only active GTTs can be cancelled. Already-triggered, expired, or previously cancelled GTTs cannot be cancelled again.
  • Cancelling an OCO removes both legs (stoploss + target) atomically. There is no per-leg cancel.
  • Cancellation is broker-side; once acknowledged, the trigger is removed and won't appear in subsequent default GTTOrderBook calls, which list active triggers only; send status: all to see it in the history as cancelled.
  • Idempotency: cancelling an already-cancelled trigger returns the broker's native response, which may be either success or an error like "Trigger not found" depending on the broker.
  • Analyzer (sandbox) mode cancels the sandbox trigger, releases its reserved margin and answers with "mode": "analyze". Cancelling a trigger that is no longer active is a 404: No active GTT with trigger_id '...'.

Error Scenarios

ErrorCause
trigger_id is required (400)Missing or empty trigger_id
Invalid tradeboard apikey (403)Bad / unrecognised API key
GTT orders are not supported for broker 'X' yet (501)Broker doesn't ship a gtt_api module
Failed to cancel GTT (4xx/5xx)Broker rejected, usually because the trigger is no longer active

Back to: API Documentation