Skip to Main Content
POST/NorenWClientAPI/CancelGTTOrder

Cancel GTT Order

Cancel a pending GTT order by its Alert ID before its trigger condition fires.

API Endpoint

MethodPOST
URLhttps://api.shoonya.com/NorenWClientAPI/CancelGTTOrder
Content-Typeapplication/x-www-form-urlencoded
PayloadjData=<JSON payload>&jKey=<AccessToken>

Parameters

FieldTypeRequiredDescription
uidstringRequiredUser ID of the logged-in user.
al_idstringRequiredAlert ID returned by Place GTT Order.

Request Examples

import requests, json

payload = {"uid": "AB1234", "al_id": "210415000000010"}
data = f"jData={json.dumps(payload)}&jKey={accessToken}"

response = requests.post(
    "https://api.shoonya.com/NorenWClientAPI/CancelGTTOrder",
    data=data,
)
print(response.json())
const payload = { uid: "AB1234", al_id: "210415000000010" };
const data = `jData=${JSON.stringify(payload)}&jKey=${accessToken}`;

const res = await fetch("https://api.shoonya.com/NorenWClientAPI/CancelGTTOrder", {
  method: "POST",
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
  body: data,
});
console.log(await res.json());
curl -X POST https://api.shoonya.com/NorenWClientAPI/CancelGTTOrder \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode 'jData={"uid":"AB1234","al_id":"210415000000010"}' \
  --data-urlencode "jKey=$ACCESS_TOKEN"

Response

json
// Success
{
  "request_time": "12:20:01 15-04-2021",
  "stat": "Oi delete success",
  "al_id": "210415000000013"
}

// Failure
{
  "stat": "Not_Ok",
  "emsg": "Session Expired : Invalid Session Key"
}
FieldDescription
statSuccess/failure indication (status string on success).
al_idThe cancelled Alert ID, echoed back on success.
emsgPresent only on failure.

Best Practices

  • Fetch al_id from Get Pending GTT Order right before cancelling if you didn't keep the ID from placement — it's the only key this endpoint accepts.
  • A cancel call on an al_id that has already triggered (and become a live order) will fail — check Get Pending GTT Order first if there's any chance the trigger condition was recently met.
  • Treat stat as a free-form string ("Oi delete success") rather than pattern-matching on an exact value — check for the absence of emsg, or that the returned al_id matches what you sent.