Orders¶
The order management API lets you place a new order, cancel or modify the pending order, retrieve the order status, trade status, order book & tradebook.
Type | Apis | Details |
---|---|---|
POST | od-rest/orders/execute | Place a new order |
POST | od-rest/orders/modify | Modify a pending order |
POST | od-rest/orders/cancel | Cancel a pending order |
POST | od-rest/orders/getmargin | Get order margin |
GET | od-rest/info/orderbook | Retrieve the list of all orders for the day |
GET | od-rest/info/tradebook | Retrieve the list of all trades for the day |
POST | od-rest/info/history | Get order history |
Place Order¶
Request Structure
[
{
"exchange": "NSE",
"tradingSymbol": "ZOMATO-EQ",
"qty": "1",
"price": "52",
"product": "MIS",
"transType": "B",
"priceType": "L",
"orderType" :"Regular",
"ret": "DAY",
"source":"WEB",
"triggerPrice": "",
"disclosedQty": "",
"mktProtection": "",
"target": "",
"stopLoss": "",
"trailingPrice": ""
}
]
Input parameters
Field | Type | Description |
---|---|---|
exchange | String | Name of the exchange (NSE, NFO, CDS, MCX) |
tradingSymbol | String | Exchange tradingsymbol of the of the instrument |
qty | String | Quantity to transact |
price | String | The price to execute the order |
product | String | Product code (MIS, CNC, NRML) |
transType | String | BUY or SELL (B, S) |
priceType | String | PriceType (L, MKt, SL, SL-M) |
orderType | String | Ordertypes (Regular, Cover, Bracket) |
ret | String | Retention type (from LoadRetentionType rest api).These orders state the system to keep the orders pending until the market price reaches the specified limit order price. The various retention orders are: Day or End of Session Order: This is the most commonly used retention type |
source | String | Source or platform through which the order was placed (API, WEB, MOB) |
triggerPrice | String | The price at which an order should be triggered (SL, SL-M) |
disclosedQty | String | Quantity to be disclosed (may be different from actual quantity) to the public exchange orderbook. Only for equitie |
mktProtection | String | A market-with-protection order cancels an order to buy or sell stock or other assets and re-submits it as a limit order. A broker might submit a market-with-protection order if the price of the stock has moved unexpectedly and dramatically since the market order was placed |
target | String | Target Price is a limit that is the best possible outcome for the stockholder's investment |
stopLoss | String | Stop Loss to minimise the loss in a trade |
trailingPrice | String | A trailing stop loss order adjusts the stop price at a fixed percent or number of points below or above the market price of a stock |
remarks | String | G_{Your company name} |
Response Structure
[
{
"status": "Ok",
"message": "Success",
"result": [
{
"requestTime": "12:57:31 15-11-2023",
"orderNo": "23111500003840"
}
]
}
]
Parameters
Field | Type | Description |
---|---|---|
requestTime | String | Time when the request was made |
orderNo | String | Unique number code of an order |
Modify Order¶
Using this API one can modify pending order in orderbook. The variables that can be modified are price, quantity, order type & validity. The user has to mention the desired value in fields.
Request Structure
{
"exchange": "NSE",
"tradingSymbol": "ZOMATO-EQ",
"orderNo": "23060200005839",
"qty":"5",
"ret": "DAY",
"priceType": "MKT",
"transType": "B",
"price": "0",
"triggerPrice": "",
"disclosedQty": "",
"mktProtection": "",
"target": "",
"stopLoss": "",
"trailingPrice": ""
}
Parameters
Field | Type | Description |
---|---|---|
exchange | String | Name of the exchange (NSE, NFO, CDS, MCX) |
tradingSymbol | String | Exchange tradingsymbol of the of the instrument |
qty | String | Quantity to transact |
orderNo | String | Unique number code of an order |
price | String | The price to execute the order |
transType | String | BUY or SELL |
priceType | String | PriceType (L, MKt , SL , SL-M) |
orderType | String | Ordertypes(MIS,CNC,NRML) |
triggerPrice | String | The price at which an order should be triggered (SL, SL-M) |
disclosedQty | String | Quantity to be disclosed (may be different from actual quantity) to the public exchange orderbook. Only for equitie |
mktProtection | String | A market-with-protection order cancels an order to buy or sell stock or other assets and re-submits it as a limit order. A broker might submit a market-with-protection order if the price of the stock has moved unexpectedly and dramatically since the market order was placed |
target | String | Target Price is a limit that is the best possible outcome for the stockholder's investment |
stopLoss | String | Stop Loss to minimise the loss in a trade |
trailingPrice | String | A trailing stop loss order adjusts the stop price at a fixed percent or number of points below or above the market price of a stock |
Response Structure
{
"status": "Ok",
"message": "Success",
"result": [
{
"requestTime": "13:12:28 15-11-2023",
"orderNo": "23111500003987"
}
]
}
Parameters
Field | Type | Description |
---|---|---|
requestTime | String | Time when the request was made |
orderNo | String | Unique number code of an order |
Cancel Order¶
Users can cancel a pending order in the orderbook using the order id of an order. There is no body for request and response for this call.
Request Structure
Field | Type | Description |
---|---|---|
orderNo | String | Unique number code of an order |
Response Structure
[
{
"status": "Ok",
"message": "Success",
"result": [
{
"requestTime": "17:00:40 02-06-2023",
"orderNo": "23060200005839"
}
]
}
]
Parameters
Field | Type | Description |
---|---|---|
requestTime | String | Time when the request was made |
orderNo | String | Unique number code of an order |
Get Margin¶
Request Structure
{
"exchange": "NSE",
"tradingSymbol": "ZOMATO-EQ",
"qty": "1",
"price": "0",
"product": "MIS",
"transType": "B",
"priceType": "MKT",
"orderType": "Regular",
"triggerPrice":"",
"stopLoss":""
}
Parameters
Field | Type | Description |
---|---|---|
exchange | String | Name of the exchange (NSE, NFO, CDS, MCX) |
tradingSymbol | String | Exchange tradingsymbol of the of the instrument |
qty | String | Quantity to transact |
price | String | Price at which main leg of bracket order will be placed |
product | String | Product code (MIS or CNC or NRML) |
tranType | String | Buy and Sell |
priceType | String | Price type(L or MKT or SL or SL-M) |
orderType" | String | Ordertypes(MIS,CNC,NRML) |
triggerPrice | String | The price at which an order should be triggered (SL, SL-M) |
stopLoss | String | Stop Loss to minimise the loss in a trade |
Response Structure
{
"status": "Ok",
"message": "Success",
"result": [
{
"remarks": "Insufficient Balance",
"marginUsed": 0.0,
"openingBalance": 0.0,
"requiredMargin": 3.69,
"availableMargin": 0.0,
"marginShortfall": 3.69
}
]
}
Parameters
Field | Type | Description |
---|---|---|
remarks | String | Note related to the order |
marginUsed | String | Total margin utilized, with its interpretation varying based on the remarks |
openingBalance | String | Amount in the account |
requiredMargin | String | Margin amount required for the orde |
availableMargin | String | Remaining margin available after accounting for all factors |
marginShortfall | String | Difference between the required margin and available margin |
Fetch Order Book¶
Response Structure
{
"status": "Ok",
"message": "Success",
"result": [
{
"orderNo": "23111500003987",
"userId": "<USER_ID>",
"actId": "<ACT_ID>",
"exchange": "NSE",
"tradingSymbol": "IDEA-EQ",
"qty": "1",
"transType": "B",
"ret": "DAY",
"token": "14366",
"multiplier": "1",
"lotSize": "1",
"tickSize": "0.05",
"price": "0.00",
"avgTradePrice": null,
"disclosedQty": "3",
"product": "MIS",
"priceType": "MKT",
"orderType": "Regular",
"orderStatus": "REJECTED",
"fillShares": "0",
"exchUpdateTime": null,
"exchOrderId": null,
"formattedInsName": "IDEA-EQ",
"ltp": null,
"rejectedReason": "SAF:order is not open to cancel",
"triggerPrice": null,
"mktProtection": null,
"target": null,
"stopLoss": null,
"trailingPrice": null,
"snoOrderNumber": null,
"snoFillid": null,
"orderTime": "13:14:55 15-11-2023",
"rprice": "0.00",
"rqty": "0"
}
]
}
Parameters
Field | Type | Description |
---|---|---|
orderNo | String | Order Number is defined as Unique number it can be generated while placing the order |
userId | String | The unique, permanent user ID registered with the broker |
actId | String | The unique, permanent user ID registered with the broker |
exchange | String | Exchange (NSE or NFO or MCX) |
tradingSymbol | String | Exchange tradingsymbol of the of the instrument |
qty | String | Quantity to transact |
tranType | String | Buy and Sell |
ret | String | Retention type (from LoadRetentionType rest api).These orders state the system to keep the orders pending until the market price reaches the specified limit order price. The various retention orders are: Day or End of Session Order: This is the most commonly used retention type |
token | String | Token of the scrip. Token Number is a unique code given to all companies listed on the exchange. Selected Instrument token number will be displayed under scrip details |
priceType | String | Price type(L or MKT or SL or SL-M) |
ret | String | Retention type (from LoadRetentionType rest api).These orders state the system to keep the orders pending until the market price reaches the specified limit order price. The various retention orders are: Day or End of Session Order: This is the most commonly used retention type |
multiplier | String | The Multiplier Of Scrip |
lotSize | String | Quantity of a single lot |
tickSize | String | Ticker Size Of The Scrip (in paisa).Tick size is the minimum price change between different bid and offer prices of an asset traded on an exchange platform |
price | String | Price at which main leg of bracket order will be placed |
avgTradePrice | String | Average Trade price |
disclosedQty | String | Quantity to be disclosed (may be different from actual quantity) to the public exchange orderbook |
product | String | Product code (MIS or CNC or NRML) |
priceType | String | PriceType (L, MKt , SL , SL-M) |
orderType | String | Ordertypes(MIS,CNC,NRML) |
orderStatus | String | Indicates the current status or condition of the order within the system or exchange. |
fillShares | String | The Number of shares got filled |
exchUpdateTime | String | Timestamp indicating the last update time from the exchange |
exchOrderId | String | Unique identifier assigned by the exchange for the order |
formattedInsName | String | Formatted name of the financial instrument or asset. |
ltp | String | Last trade price of the scrip. The price at which the final trade happens between a buyer and a seller |
rejectedReason | String | Rejection Reason for the order will be displayed |
triggerPrice | String | New trigger price in case of SL-MKT or SL-LMT |
mktProtection | String | A market-with-protection order cancels an order to buy or sell stock or other assets and re-submits it as a limit order. A broker might submit a market-with-protection order if the price of the stock has moved unexpectedly and dramatically since the market order was placed. |
target | String | Target Price is a limit that is the best possible outcome for the stockholder's investment. |
stopLoss | String | Predefined price level set to limit potential losses on an order |
trailingPrice | String | Trailing Price applicable only if product is selected as H and B (High Leverage and Bracket order ) |
snoOrderNumber | String | Unique identifier assigned by the system for the order |
snoFillid | String | Unique identifier assigned by the system for the filled order |
OrderTime | String | Timestamp indicating when the order was placed |
rPrice | String | Reference or reserved price associated with the order |
rQty | String | Reference or reserved quantity associated with the order |
Fetch Trade Book¶
Response Structure
{
"status": "Ok",
"message": "Success",
"result": [
{
"orderNo": "23061200004704",
"userId": "<USER_ID>",
"actId": "<ACT_ID>",
"exchange": "NSE",
"ret": "DAY",
"product": "MIS",
"orderType": "Regular",
"priceType": "MKT",
"fillId": "79689595",
"fillTime": "12-06-2023 15:15:49",
"transType": "S",
"tradingSymbol": "SBIN-EQ",
"qty": "2",
"token": "3045",
"fillshares": "2",
"fillqty": "2",
"pricePrecision": "2",
"lotSize": "1",
"tickSize": "0.05",
"price": "0.00",
"prcftr": "1.000000",
"fillprc": "578.40",
"exchUpdateTime": "12-06-2023 15:15:49",
"exchOrderId": "1300000022510042",
"formattedInsName": "SBIN-EQ",
"ltp": null,
"orderTime": "15:15:49 12-06-2023"
},
]
}
Parameters
Field | Type | Description |
---|---|---|
orderNo | String | Order Number is defined as Unique number it can be generated while placing the order |
userId | String | The unique, permanent user ID registered |
actId | String | The unique, permanent user ID registered |
exchange | String | Exchange (NSE or NFO or MCX) |
ret | String | Retention type (from LoadRetentionType rest api).These orders state the system to keep the orders pending until the market price reaches the specified limit order price. The various retention orders are: Day or End of Session Order: This is the most commonly used retention type |
product | String | Product code (MIS or CNC or NRML) |
orderType | String | Ordertypes(MIS,CNC,NRML) |
priceType | String | PriceType (L, MKt , SL , SL-M) |
fillID | String | Unique identifier for the filled order |
fillTime | String | Timestamp indicating when the order was filled |
tranType | String | Buy and Sell |
tradingSymbol | String | Exchange tradingsymbol of the of the instrument |
qty | String | Quantity to transact |
token | String | Token of the scrip. Token Number is a unique code given to all companies listed on the exchange. Selected Instrument token number will be displayed under scrip details |
fillShares | String | The Number of shares got filled |
fillqty | String | Quantity filled from the order |
pricePrecision | String | Level of detail |
lotSize | String | Quantity of a single lot |
tickSize | String | Ticker Size Of The Scrip (in paisa).Tick size is the minimum price change between different bid and offer prices of an asset traded on an exchange platform |
price | String | Price at which main leg of bracket order will be placed |
fillprc | String | Price at which the order was filled |
exchUpdateTime | String | Timestamp related to exchange order updates |
exchOrderId | String | Identifier assigned by the exchange for the order |
formattedInsName | String | Formatted name of the instrument |
ltp | String | Last trade price of the scrip. The price at which the final trade happens between a buyer and a seller |
OrderTime | String | Timestamp indicating when the order was placed |
Order History¶
Request Structure
Input parameters
Field | Type | Description |
---|---|---|
userId | String | The unique, permanent user ID registered with the broker |
orderNo | String | Order Number is defined as Unique number it can be generated while placing the order |
Response Structure
{
"status": "Ok",
"message": "Success",
"result": [
{
"orderNo": "23111500004681",
"userId": "<USER_ID>",
"actId": "<ACT_ID>",
"exchange": "NSE",
"tradingSymbol": "IDEA-EQ",
"quantity": "1",
"transType": "B",
"priceType": "MKT",
"orderType": "Regular",
"ret": "DAY",
"token": "14366",
"pricePrecision": "2",
"lotSize": "1",
"tickSize": "0.05",
"price": "0.00",
"avgPrice": null,
"disclosedQty": "3",
"product": "MIS",
"status": "REJECTED",
"report": "Rejected",
"fillshares": "0",
"time": "13:44:17 15-11-2023",
"exchTime": null,
"remarks": null,
"exchOrderNo": null
},
{
"orderNo": "23111500004681",
"userId": "<USER_ID>",
"actId": "<ACT_ID>",
"exchange": "NSE",
"tradingSymbol": "IDEA-EQ",
"quantity": "1",
"transType": "B",
"priceType": "MKT",
"orderType": "Regular",
"ret": "DAY",
"token": "14366",
"pricePrecision": "2",
"lotSize": "1",
"tickSize": "0.05",
"price": "0.00",
"avgPrice": null,
"disclosedQty": "3",
"product": "MIS",
"status": "PENDING",
"report": "NewAck",
"fillshares": "0",
"time": "13:44:17 15-11-2023",
"exchTime": null,
"remarks": null,
"exchOrderNo": null
}
]
}
parameters
Field | Type | Description |
---|---|---|
orderNo | String | Order Number is defined as Unique number it can be generated while placing the order |
userId | String | The unique, permanent user ID registered |
actId | String | The unique, permanent act Id registered |
exchange | String | Exchange Segments |
tradingSymbol | String | Exchange tradingsymbol of the of the instrument |
quantity | String | Quantity to transact |
priceType | String | PriceType (L, MKt , SL , SL-M) |
ret | String | Retention type (from LoadRetentionType rest api).These orders state the system to keep the orders pending until the market price reaches the specified limit order price. The various retention orders are: Day or End of Session Order: This is the most commonly used retention type |
token | String | Token of the scrip. Token Number is a unique code given to all companies listed on the exchange. Selected Instrument token number will be displayed under scrip details |
pricePrecision | String | Level of details |
lotSize | String | Quantity of a single lot |
tickSize | String | Ticker Size Of The Scrip (in paisa).Tick size is the minimum price change between different bid and offer prices of an asset traded on an exchange platform |
price | String | Price at which main leg of bracket order will be placed |
avgPrice | String | Average price of the order |
disclosedQty | String | Quantity to be disclosed (may be different from actual quantity) to the public exchange orderbook. Only for equitie |
product | String | Product code (MIS or CNC or NRML) |
status | String | Condition of the order |
fillshares | String | The Number of shares got filled |
time | String | Timestamp indicating a specific time related to the order |
exchTime | String | Exchange-specific timestamp |
exchOrderNo | String | exchOrderNo (Exchange Order Number) |