Skip to Content

Modify Smart Order

This API allows you to modify a pending smart order, such as its quantity, price limits or time settings.

USE CASE

Change the quantity, price limits or end time of a smart order without cancelling it.

Send only the fields you want to change.

Note

The smart order must be paused before it can be modified, except for SIP. Partial updates are supported.

  • The order must be in a paused state to be modified (except SIP orders).
  • Only include the parameters you want to update. All others will retain their original values.
  • Certain parameters cannot be modified once the order has started executing.

Details

  • You can modify a pending Smart Order by updating parameters such as quantity, price, and time settings, depending on the order type.
  • Send the flowId plus the fields to change. The fields you can change depend on the order type: Limit (flowtype 4), Trail (6), Step (3) or SIP (7).
  • The usual flow is Pause, then Modify, then Resume. Pausing first is not needed for Smart Limit and SIP orders. Resuming is mandatory after a modification.
  • Orders that are already executed, cancelled or cancelled by the system cannot be modified.
  • qty cannot be lower than the remaining quantity. It must be a multiple of the lot size and within the freeze limit.
  • For a Step order, initQty, limitPrice and orderType cannot be changed once the order has started.
  • For a Trail order, send unsetTargetPrice as true to remove the target price. limitPrice is required for a Limit order and must be 0 for a Market order.
  • For a SIP, the frequency cannot change, and an amount-based SIP cannot be switched to quantity-based or the other way round.
  • Rate limits differ between the Standard and Prime plans. See Plans & rate limits.

Request Attributes

AttributeData TypeRequiredDescription
flowIdstringYesUnique identifier of the Smart Order to be modified

Optional Request Attributes (by Order Type)

Limit Order (flowtype: 4)

AttributeData TypeDescription
qtyintTo update order quantity
limitPricefloatTo update limit price
stopPricefloatTo update stop/trigger price
endTimeintTo update expiry time (Unix timestamp)
hprfloatTo update upper price limit (High Price Range)
lprfloatTo update lower price limit (Low Price Range)
mppfloatTo update market protection percentage
onExpintTo update expiry action (1 = Cancel, 2 = Market Order)

Trail Order (flowtype: 6)

AttributeData TypeDescription
qtyintTo update order quantity
limitPricefloatTo update limit price (required if orderType = 1; must be 0 if orderType = 2)
stopPricefloatTo update stop/trigger price
jump_difffloatTo update jump value for trailing stop
target_pricefloatTo update target price (optional profit booking)
unsetTargetPricebooleanSet true to remove/unset the existing target_price
mppfloatTo update market protection percentage

Step Order (flowtype: 3)

AttributeData TypeDescription
qtyintTo update total order quantity
startTimeintTo update order start time
endTimeintTo update order end time
hprfloatTo update upper price limit (High Price Range)
lprfloatTo update lower price limit (Low Price Range)
mppfloatTo update market protection percentage
avgqtyintTo update quantity per averaging step
avgdifffloatTo update price gap between steps
initQtyintTo update initial quantity (only before order starts)
limitPricefloatTo update limit price (only before order starts)
directionintTo update direction for averaging (1 = price drop, -1 = price rise)

SIP Order (flowtype: 7)

AttributeData TypeDescription
qtyintTo update investment quantity per instalment
amountfloatTo update investment amount per instalment
hprfloatTo update upper price limit (skip if price is above this)
lprfloatTo update lower price limit (skip if price is below this)
sip_dayintTo update SIP day (applicable for monthly/custom frequency)
sip_timeintTo update SIP time (required for daily/custom frequency)
step_up_amountfloatTo update step-up amount (amount-based SIP only)
step_up_qtyintTo update step-up quantity (qty-based SIP only)
exp_qtyintTo update expiry quantity (optional)
exp_amountfloatTo update expiry amount (optional)

Validations & Error Handling

General Validations

ScenarioError Message
Invalid flowid"The provided smart order ID is invalid."
Invalid request payload"The input details entered is invalid."
Invalid order type"Invalid Order type"
Order not paused (v3)"The smart order must be paused before it can be modified."
Order already executed"The modification attempt failed as the smart order was already executed."
Order already cancelled"The modification attempt failed as the smart order was already cancelled."
Order cancelled by system"The modification attempt failed as the smart order cancelled by system"
Qty < remaining qty"Modification attempt failed as the specified quantity is less than the remaining quantity."
Qty not multiple of lot size"Quantity should be multiple of min lot size."
Qty exceeds freeze limit"Quantity exceeds the allowable freeze limit."
Field not allowed"Amount field is not allowed."
SIP: changing frequency"SIP frequency cannot be changed. Please use the same frequency as the existing order."
SIP: changing amount->qty"Cannot change from amount-based SIP to qty-based SIP. Please use amount to modify this order."
SIP: changing qty->amount"Cannot change from qty-based SIP to amount-based SIP. Please use qty to modify this order."

Limit Order Validations (flowtype: 4)

AttributeValidation RuleError Message
endTimeMust be within market hours"End time cannot fall within market closed hours."
endTimeMust not be in the past"The end time entered is earlier than the current time."
endTimeMust be within current day"The end time cannot extend beyond midnight of the current day."
hpr (buy)If provided (>0), must be >= limitPrice"The maximum price must be higher than the limit price."
lpr (sell)If provided (>0), must be <= limitPrice"The minimum price must be lower than the limit price."
stopPrice (buy)If orderType=4, must be < limitPrice"For buy orders, the stop price must be lower than the limit price."
stopPrice (sell)If orderType=4, must be > limitPrice"For sell orders, the stop price must be higher than the limit price."
mppMust be 0-3 or -1 (disabled)"MPP must be either -1 or a value between 0 to 3% (0 to 3)."

Trail Order Validations (flowtype: 6)

AttributeValidation RuleError Message
stopPriceRequired for trail orders"Stop Price is required to place orders."
limitPriceRequired when orderType=1 (Limit)"Limit price is required."
limitPrice (buy)If orderType=1, must be < stopPrice"For buy orders, the stop price must be lower than the limit price."
limitPrice (sell)If orderType=1, must be > stopPrice"For sell orders, the stop price must be higher than the limit price."
target_priceIf provided (>0), must be > current LTP"The target price must be greater than the last traded price."
jump_diffMust be > 20× tick size"The jump price must be more than 20 times the tick size."
mppMust be 0-3 or -1 (disabled)"MPP must be either -1 or a value between 0 to 3% (0 to 3)."

Step Order Validations (flowtype: 3)

AttributeValidation RuleError Message
startTimeNot allowed in modify request"Start time is not required for modify orders."
startTimeMust not be in the past"The start time entered is earlier than the current time."
startTimeMust be within market hours"Start time cannot fall within market closed hours."
endTimeMust not be in the past"The end time entered is earlier than the current time."
endTimeMust be within market hours"End time cannot fall within market closed hours."
avgqtyMust be multiple of lot size"Avg quantity should be multiple of min lot size."
initQtyCannot modify after order starts"You cannot modify the initial quantity after the order has been placed."
limitPriceCannot modify after order starts"You cannot modify the Limit price after the order has been placed."
orderTypeCannot modify after order starts"You cannot modify the order type after the order has been placed."
qtyTotal qty >= initQty + avgQty"Total Quantity should be greater than or equal to the sum of Initial Qty and Average Qty."
mppMust be 0-3 or -1 (disabled)"MPP must be either -1 or a value between 0 to 3% (0 to 3)."

Response Attributes

AttributeData TypeDescription
codeintStatus code: 200 for success; negative values indicate errors.
messagestringMessage indicating success or failure. Example: "Request sent successfully to modify smart order."
sstring"ok" for success, "error" for failure.
Last updated on