Skip to content

ModifyGTTOrder

Modify an active GTT trigger. The body is a full replacement of the trigger spec: the same shape as PlaceGTTOrder plus trigger_id. The broker's underlying PUT replaces trigger prices, leg limits, and order params atomically.

Send everything you want to keep. Modify is not a patch: fields you omit are not preserved.

SINGLE vs OCO: Same Trigger Type as Original

You can modify any of the price levels, the quantity, or the pricetype, but you cannot switch a SINGLE into an OCO (or vice versa). If you need that, cancel and re-place.

TypeUse when…TriggersOrders fired
SINGLEYou set up one entry/exit at a level.11
OCO (One-Cancels-Other)You set up a stoploss + target bracket.21 of 2 (the other is auto-cancelled)

In SINGLE there is no second leg and no automatic cancel: once your one trigger fires and the order is placed, the GTT is finished.

How to Choose triggerprice_sl vs triggerprice_tg (SINGLE only)

For SINGLE, exactly one of these two fields is your trigger price; set the other to 0. Pick based on where your trigger sits relative to LTP:

FieldTrigger sits…Typical intent
triggerprice_slbelow current LTPSELL stop-loss · BUY-on-dip · BUY-the-fall
triggerprice_tgabove current LTPBUY breakout · SELL-at-target · SELL-the-rise

For OCO, you always send both: triggerprice_sl (the lower trigger, your stoploss) and triggerprice_tg (the higher trigger, your target).

Note on naming. In SINGLE, triggerprice_sl / triggerprice_tg are just the trigger price, the generic "price at which the order is triggered". The _sl / _tg suffix is only a directional hint (sits below / above LTP); SINGLE has no stoploss leg. In OCO, the suffix becomes a real role: triggerprice_sl is the stoploss-leg trigger and triggerprice_tg is the target-leg trigger.

Endpoint URL

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

Sample API Request (SINGLE): "Move my IDEA dip-buy from 9.55 to 9.65, raise limit to 9.60"

json
{
  "apikey": "<your_app_apikey>",
  "strategy": "My GTT Strategy",
  "trigger_id": "23132604291205",
  "trigger_type": "SINGLE",
  "exchange": "NSE",
  "symbol": "IDEA",
  "action": "BUY",
  "product": "CNC",
  "quantity": 1,
  "pricetype": "LIMIT",
  "price": 9.60,
  "triggerprice_sl": 9.65,
  "triggerprice_tg": 0,
  "stoploss": null,
  "target": null
}

LTP is currently above 9.65 → trigger sits below LTP → use triggerprice_sl.

Sample cURL Request

bash
curl -X POST http://127.0.0.1:5000/api/v1/modifygttorder \
  -H 'Content-Type: application/json' \
  -d '{
  "apikey": "<your_app_apikey>",
  "strategy": "My GTT Strategy",
  "trigger_id": "23132604291205",
  "trigger_type": "SINGLE",
  "exchange": "NSE",
  "symbol": "IDEA",
  "action": "BUY",
  "product": "CNC",
  "quantity": 1,
  "pricetype": "LIMIT",
  "price": 9.60,
  "triggerprice_sl": 9.65,
  "triggerprice_tg": 0,
  "stoploss": null,
  "target": null
}'

Sample API Response

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

Sample API Request (OCO): "Tighten my INFY bracket, stop 1480 to 1485, target 1620 to 1625"

json
{
  "apikey": "<your_app_apikey>",
  "strategy": "Bracket OCO",
  "trigger_id": "23132604291213",
  "trigger_type": "OCO",
  "exchange": "NSE",
  "symbol": "INFY",
  "action": "SELL",
  "product": "CNC",
  "quantity": 5,
  "pricetype": "LIMIT",
  "price": 0,
  "triggerprice_sl": 1485,
  "stoploss": 1483,
  "triggerprice_tg": 1625,
  "target": 1627
}

price=0 because OCO uses per-leg limit prices: stoploss (the SL leg's limit) and target (the target leg's limit).

Parameters Description

ParametersDescriptionMandatory/OptionalDefault Value
apikeyTradeboard API key (string)Mandatory-
strategyStrategy identifier (string)Mandatory-
trigger_idThe trigger ID returned by PlaceGTTOrder. Identifies which active GTT to modify (string)Mandatory-
trigger_typeSINGLE or OCO. Must match the original trigger's type (string)Mandatory-
exchangeAny value in the shared VALID_EXCHANGES list (string)Mandatory-
symbolTrading symbol in Tradeboard format (string)Mandatory-
actionBUY or SELL (string). For OCO, applies to both legs.Mandatory-
productCNC (equity delivery) or NRML (F&O overnight). MIS is not supported for GTT. (string)Mandatory-
quantityNew order quantity. Integer for equity/F&O; fractional float allowed for crypto (number).Mandatory-
pricetypeLIMIT or MARKET (string)OptionalLIMIT
priceSINGLE only. New limit price of the child order. Send 0 when pricetype=MARKET. Ignored for OCO. (float)Mandatory-
triggerprice_slNew trigger price below LTP. SINGLE: use this OR triggerprice_tg. OCO: required (the stoploss-leg trigger). (float)Conditional0
triggerprice_tgNew trigger price above LTP. SINGLE: use this OR triggerprice_sl. OCO: required (the target-leg trigger). (float)Conditional0
stoplossOCO only. New limit price for the stoploss leg's child order. Ignored for SINGLE. (float, null, or "")Conditionalnull
targetOCO only. New limit price for the target leg's child order. Ignored for SINGLE. (float, null, or "")Conditionalnull

ModifyGTTOrderSchema has no expires_at field: expiry cannot be changed on an existing trigger. Like the place schema it sets unknown = EXCLUDE, so unrecognized fields are dropped rather than rejected, and dropped fields never reach the broker.

Trigger Field Rules

trigger_typeWhat you must sendConstraint
SINGLEexactly one of triggerprice_sl / triggerprice_tg (>0); the other = 0price is the child order's limit; send 0 for MARKET.
OCOall four: triggerprice_sl, stoploss, triggerprice_tg, target (all >0)triggerprice_sl < triggerprice_tg. Both legs share action, quantity, product.

Response Fields

FieldTypeDescription
statusstring"success" or "error"
trigger_idstringModified trigger ID (same value you sent)
messagestringError message (on failure)

What Can Be Modified?

ParameterModifiableNotes
Trigger prices (triggerprice_sl / triggerprice_tg)YesFor OCO, both legs swap atomically.
Limit prices (price / stoploss / target)Yes
quantityYesMust be a valid lot size for F&O.
pricetypeYesLIMITMARKET (see broker-specific notes below).
trigger_typeNoCannot switch SINGLE to OCO or back. Cancel and re-place.
symbol / exchangeNoCannot change instrument.
actionNoCannot change BUY ↔ SELL.

Notes

  • Numeric fields (quantity, price, triggerprice_sl, triggerprice_tg, stoploss, target) are JSON floats. Empty strings ("") for stoploss/target/triggerprice_sl/triggerprice_tg are also accepted and coerced to null/0.
  • Modify is a full replacement: every field on the trigger is replaced. Always send all fields you want to keep, not just the diff.
  • Only active GTTs can be modified. Triggered, cancelled, or expired GTTs are immutable.
  • last_price is fetched server-side from the broker's quotes endpoint. You don't need to send it.
  • OCO modify atomicity: Tradeboard aims to update both legs of an OCO atomically; some brokers expose a per-leg modify under the hood and may, in rare failure cases, leave the OCO in a half-modified state. Re-issue the modify, or cancel and re-place, if the response indicates partial failure.
  • MARKET handling: same auto-conversion behaviour as PlaceGTTOrder; broker-specific quirks are absorbed in the broker layer.
  • Semi-auto mode blocks GTT modify (parity with ModifyOrder). Switch to Auto mode if you see a 403.
  • Analyzer (sandbox) mode modifies the sandbox trigger and answers with "mode": "analyze". The same immutability rules apply: trigger type, symbol, exchange and action cannot change.

Error Scenarios

ErrorCause
trigger_id is required (400)Missing trigger_id
Modify GTT order is not allowed in Semi-Auto mode (403)User in Semi-Auto mode
triggerprice_sl: Stoploss trigger must be less than target triggerOCO with triggerprice_sl >= triggerprice_tg
GTT supports only CNC (delivery) or NRML (overnight F&O); MIS is intraday-only.product=MIS submitted
Failed to fetch last_price from broker quotes (502)Broker quotes endpoint unavailable
GTT orders are not supported for broker 'X' yet (501)Broker capability gate

Back to: API Documentation