Skip to Main Content
POST/NorenWClientAPI/PlaceGTTOrder

Place GTT Order

Register a Good-Till-Triggered order: an order that stays dormant until the specified LTP condition is met, at which point it's submitted to the exchange with the given order parameters.

API Endpoint

MethodPOST
URLhttps://api.shoonya.com/NorenWClientAPI/PlaceGTTOrder
Content-Typeapplication/x-www-form-urlencoded
PayloadjData=<JSON payload>&jKey=<AccessToken> — requires a valid AccessToken from Login.

Overview

Place GTT Order is a superset of Set Alert: it carries the same trigger-condition fields (ai_t, d, validity) plus the full order payload (trantype, prctyp, prd, qty, prc, etc.) that gets submitted once the condition fires. Unlike Place Order, prctyp here also allows MKT, DS, 2L, and 3L.

Parameters

FieldTypeRequiredDescriptionAllowed Values
uidstringRequiredUser ID of the logged-in user.Account-specific
actidstringRequiredLogin user's account ID.Account-specific
tsymstringRequiredTrading symbol.Must exist in Symbol Master
exchstringRequiredExchange segment.See Exchange Segment Codes
ai_tstringRequiredAlert type the trigger condition is evaluated against.See Get Enabled GTT Orders
validitystringRequiredValidity of the trigger.DAY, GTT
dstringOptionalValue compared against LTP to decide when the order fires.Numeric string
remarksstringRequiredFree-text message for identification.Free text
trantypestringRequiredTransaction type.B (Buy), S (Sell)
prctypstringRequiredOrder type submitted on trigger.LMT, MKT, SL-LMT, SL-MKT, DS, 2L, 3L
prdstringRequiredProduct type.C, M, H
retstringRequiredRetention type of the resulting order (options depend on exchange).DAY, EOS, IOC
qtyintegerRequiredOrder quantity.> 0, lot-size multiple for derivatives
prcnumberRequiredOrder price submitted on trigger.> 0
dscqtyintegerOptionalDisclosed quantity.Max 10% (NSE), 50% (MCX)

Request Examples

import requests, json

payload = {
    "uid": "AB1234",
    "actid": "AB1234",
    "tsym": "RELIANCE-EQ",
    "exch": "NSE",
    "ai_t": "LTP",
    "validity": "GTT",
    "d": "2500",
    "remarks": "gtt-breakout-buy",
    "trantype": "B",
    "prctyp": "LMT",
    "prd": "C",
    "ret": "DAY",
    "qty": "1",
    "prc": "2505.0",
}
data = f"jData={json.dumps(payload)}&jKey={accessToken}"

response = requests.post(
    "https://api.shoonya.com/NorenWClientAPI/PlaceGTTOrder",
    data=data,
)
result = response.json()

if result.get("al_id"):
    print("GTT order placed:", result["al_id"])
else:
    print("GTT order rejected:", result.get("emsg"))
const payload = {
  uid: "AB1234",
  actid: "AB1234",
  tsym: "RELIANCE-EQ",
  exch: "NSE",
  ai_t: "LTP",
  validity: "GTT",
  d: "2500",
  remarks: "gtt-breakout-buy",
  trantype: "B",
  prctyp: "LMT",
  prd: "C",
  ret: "DAY",
  qty: "1",
  prc: "2505.0",
};
const data = `jData=${JSON.stringify(payload)}&jKey=${accessToken}`;

const res = await fetch("https://api.shoonya.com/NorenWClientAPI/PlaceGTTOrder", {
  method: "POST",
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
  body: data,
});
const result = await res.json();
console.log(result.al_id ? `GTT order placed: ${result.al_id}` : `Rejected: ${result.emsg}`);
curl -X POST https://api.shoonya.com/NorenWClientAPI/PlaceGTTOrder \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode 'jData={"uid":"AB1234","actid":"AB1234","tsym":"RELIANCE-EQ","exch":"NSE","ai_t":"LTP","validity":"GTT","d":"2500","remarks":"gtt-breakout-buy","trantype":"B","prctyp":"LMT","prd":"C","ret":"DAY","qty":"1","prc":"2505.0"}' \
  --data-urlencode "jKey=$ACCESS_TOKEN"

Response

json
// Success
{
  "request_time": "10:02:06 15-04-2021",
  "stat": "Oi created",
  "al_id": "210415000000010"
}

// Failure
{
  "stat": "Not_Ok",
  "emsg": "Session Expired : Invalid Session Key"
}
FieldDescription
statSuccess/failure indication (a status string on success, not a plain Ok flag).
request_timePresent only on success.
al_idAlert ID for this GTT order — needed for Cancel GTT Order and appears in Get Pending GTT Order.
emsgPresent only on failure — e.g. Invalid Input, Session Expired.

Best Practices

  • Check for al_id in the response before trusting the order is registered — stat is a free-form status string here, not a plain Ok/Not_Ok flag.
  • Confirm the ai_t value against Get Enabled GTT Orders before every placement — an unsupported alert type fails at request time, not silently.
  • Reconcile with Get Pending GTT Order after placing, the same way you'd reconcile a regular order against Order Book — a GTT order sits dormant for potentially a long time, so don't assume it's still there without checking.
  • Because the resulting order fires whenever the market later crosses your trigger, re-validate prc against the live circuit band and lot size at trigger time in your own monitoring — a GTT order placed weeks earlier can go stale relative to corporate actions, splits, or circuit changes.
  • MKT is allowed here even though it's rejected on Place Order — decide deliberately whether you want price protection (LMT) or fill certainty (MKT) once triggered.