CancelGttOrder
Cancel an active GTT trigger by its trigger_id. A multi-leg cancellation can partially fail; verify remaining rules in the broker book.
Endpoint URL
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/cancelgttorderSample API Request
{
"apikey": "<your_app_apikey>",
"strategy": "My GTT Strategy",
"trigger_id": "23132604291205"
}Sample cURL Request
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
Request Body
apikey
Your OpenAlgo API key
Mandatory
-
strategy
Strategy identifier (used in event logs)
Mandatory
-
trigger_id
Active trigger ID returned by PlaceGTTOrder
Mandatory
-
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
status
string
"success" or "error"
trigger_id
string
Cancelled trigger ID
message
string
Error message (on failure)
Notes
Only active GTTs can be cancelled. Already-triggered, expired, or previously cancelled GTTs cannot be cancelled again.
OCO cancellation is broker-dependent. Angel decodes the composite ID and cancels independent rules sequentially; failure can leave one active. Verify the book before considering both cancelled.
Cancellation is broker-side; once acknowledged, the trigger is removed and won't appear in subsequent default
GTTOrderBookcalls, which list active triggers only; history is visible withstatus: allonly where the broker mapper supplies it.Idempotency: cancelling an already-cancelled trigger returns the broker's native response, which may be either
successor 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
trigger_id is required (400)
Missing or empty trigger_id
Invalid openalgo 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
Related Endpoints
PlaceGTTOrder: Place a new GTT trigger
ModifyGTTOrder: Modify an active GTT
GTTOrderBook: List active GTT triggers
Back to: API Documentation
Last updated