Smart Limit Order
This API allows you to place a limit order that stays active until an end time you choose on the same trading day.
USE CASE
Place a limit order that is cancelled or converted to a market order automatically if it is not filled by your chosen time.
Note
Supported product types are CNC, MARGIN, MTF and INTRADAY. High-price range (HPR) and low-price range (LPR) apply to NSE and BSE symbols.
- Supports order placement under CNC, MARGIN, MTF, and INTRADAY.
- You can define a price range (HPR/LPR) to restrict execution within your specified limits.
- Supports only selected NSE and BSE symbols.
Details
- Smart Limit Orders allow you to place limit orders that remain active until the specified end time. Once the end time is reached, the order can be converted to an MPP order or cancelled.
endTimeis a Unix timestamp. It must be in the future, within market hours and before midnight of the current day.onExpsets what happens atendTime:1cancels the order and2turns it into a market order.orderTypeis1(Limit) or4(Stop-Limit). A Stop-Limit order needsstopPrice: lower thanlimitPricefor buy, higher for sell.hprandlprdefault to 0, meaning no limit. For a buy,hprmust not be belowlimitPrice. For a sell,lprmust not be above it.qtymust be 1 to 999999, a multiple of the lot size and within the freeze limit.limitPricemust be at least 0.01.mppmust be 0 to 3 or -1.- MTF needs MTF to be enabled and a symbol and exchange that support it. For F&O and currency derivatives only near expiries and strikes close to LTP are allowed.
- Smart orders can be created only on trading days (not special trading days), from 8:00 AM and within regular trading hours. The limit is 100 smart orders per day.
- Rate limits differ between the Standard and Prime plans. See Plans & rate limits.
Request Attributes
| Attribute | Data Type | Required | Description |
|---|---|---|---|
symbol | string | Yes | The instrument's unique identifier, e.g., "NSE:SBIN-EQ" |
side | int | Yes | Order side: 1 for Buy, -1 for Sell (enum: 1, -1) |
qty | int | Yes | Order quantity (Min: 1, Max: 999999; must be a multiple of lot size) |
productType | string | Yes | Must be one of: "CNC", "MARGIN", "INTRADAY", "MTF" |
limitPrice | float | Yes | The price at which the order should be placed (Min: 0.01) |
endTime | int | Yes | Order expiry time as a Unix timestamp (epoch) |
orderType | int | Yes | Order type: 1 for Limit, 4 for Stop-Limit (enum: 1, 4) |
onExp | int | Yes | Action on expiry: 1 = Cancel, 2 = Market (enum: 1, 2) |
stopPrice | float | No | Default: 0. Required when orderType is 4 (Stop-Limit) |
hpr | float | No | Default: 0. 0 = no upper price limit. If provided, order executes only below this price |
lpr | float | No | Default: 0. 0 = no lower price limit. If provided, order executes only above this price |
mpp | float | No | Default: 0. 0 = no market protection. Valid values: 0–3 or -1 (disabled) |
Validations & Error Handling
| Attribute | Validation Rule | Error Message |
|---|---|---|
symbol | Must be a valid trading symbol | "The symbol entered is invalid." |
symbol | Must be allowed for smart orders | "The selected symbol is not allowed for placing smart orders. Please try again with a different symbol." |
symbol | Must be allowed for this segment | "The smart order not allowed for this segment" |
side | Must be 1 or -1 (enum) | "The input details entered is invalid." |
qty | Min: 1, Max: 999999, must be multiple of lot size | "Quantity should be multiple of min lot size." |
qty | Must not exceed freeze limit | "Quantity exceeds the allowable freeze limit." |
productType | Must be one of: CNC, MARGIN, INTRADAY, MTF | "productType must be one of the following: CNC, MARGIN, INTRADAY, MTF" |
productType | MTF requires MTF activation | "MTF is not enabled. Please use a different productType" |
limitPrice | Min: 0.01 | "The input details entered is invalid." |
orderType | Must be 1 or 4 (enum) | "orderType must be one of the following: 1, 4" |
onExp | Must be 1 or 2 (enum) | "onExp must be one of the following: 1, 2" |
endTime | Must not be 0 | "EndTime is required and cannot be 0." |
endTime | Must be within market hours | "End time cannot fall within market closed hours." |
endTime | Must not be in the past | "The end time entered is earlier than the current time." |
endTime | Must be within current day | "The end time cannot extend beyond midnight of the current day." |
hpr (buy) | Min: 0, if provided (>0), must be >= limitPrice | "The maximum price must be higher than the limit price." |
lpr (sell) | Min: 0, if provided (>0), must be <= limitPrice | "The minimum price must be lower than the limit price." |
stopPrice (buy) | Min: 0, if orderType=4, must be < limitPrice | "For buy orders, the stop price must be lower than the limit price." |
stopPrice (sell) | Min: 0, if orderType=4, must be > limitPrice | "For sell orders, the stop price must be higher than the limit price." |
mpp | If provided (>0), must be 0-3 or -1 | "MPP must be either -1 or a value between 0 to 3% (0 to 3)." |
flowtype | Must be a valid smart order type | "The smart order specified in the URL path is not recognized." |
| User | Must not be banned for smart orders | "You are banned for smart order. Please contact support" |
| Trading day | Must not be market-closed day | "You can't create smart orders on market-closed day" |
| Trading day | Smart orders not allowed on special trading day | "Smart orders are not allowed on special trading day" |
| Trading hours | Must not be after market hours | "Smart orders cannot be created after market hours." |
| Trading hours | Must not be before 8:00 AM | "Smart orders are not allowed to be created before 8:00 AM." |
| Trading hours | Must be within regular trading hours | "You can't place a smart order outside regular trading hours" |
productType (MTF) | Symbol/exchange must support MTF | "This symbol or exchange is not supported for MTF." |
| Derivatives | Expiry must be allowed (F&O/CD) | "The selected contract expiry is not allowed for placing smart orders. Please try again with a near expiry contract." |
| Derivatives | Strike price must be within allowed range (F&O/CD) | "The selected strike price is out of the permitted range. Please try with a strike price closer to the LTP" |
| Daily limit | Max 100 smart orders/day | "You have exceeded the maximum limit of creating 100 smart orders for the day." |
Response Attributes
| Attribute | Data Type | Description |
|---|---|---|
code | int | Status code: 200 for success; negative values indicate errors. |
message | string | Describes the response — e.g., "Request sent successfully to place smart order" or an error message. |
s | string | "ok" for success, "error" for failure. |
id | string | Unique identifier for the placed smart order (returned only on success). |
Last updated on