Orders
The order APIs allows you to place orders of different varieties like normal orders, after market orders & stoploss orders, BO orders.
Method | APIs | Endpoint | Description |
---|---|---|---|
POST | Place Order | /orders/:variety | To place an order of a particular variety |
PUT | Modify Order | /orders/:variety/:order_id | To modify a pending order |
DELETE | Cancel Order | /orders/:variety/:order_id | To cancel a pending order |
Order Constants
Here are several of the constant enum values used for placing orders.
Parameter | Value | Description |
---|---|---|
variety | normal | Normal Order (Regular) |
amo | After market order | |
bo | BO (Bracket Order) | |
action | BUY | Buy |
SELL | Sell | |
order_type | LIMIT | Limit Order(L) |
MARKET | Market Order(MKT) | |
STOPLOSS_LIMIT | Stop Loss Limit Order(SL) | |
STOPLOSS_MARKET | Stop Loss Market Order(SL-M) | |
product_type | DELIVERY | Cash & Carry for equity |
INTRADAY | Margin & Intraday Squareoff | |
CARRYFORWARD | Normal for futures and options | |
BO | Bracket Order | |
validity | DAY | Regular Order |
IOC | Immediate or Cancel | |
EOTODY | End of Today (BSE) | |
EOSESS | End of Session (BSE) | |
exchange | NSE | NSE Cash |
BSE | BSE Cash | |
NFO | NSE Future and Options | |
NSECD | NSE Currency Futures & Options | |
MCX | MCX Futures |
Order Parameters
These parameters are common across different order varieties.
Parmaters | Description |
---|---|
variety | Different order varieties (NORMAL, AMO,BO etc.) |
action | BUY or SELL |
exchange | Name of the Exchange |
token | Symbol Token is unique identifier |
order_type | Order Type (MARKET, LIMIT etc) |
product_type | Product type (DELIVERY, INTRADAY etc.) |
quantity | Quantity to transact |
disclose_quantity | Quantity to disclose publicly (for equity trades) |
price | The min or max price to execute the order at(for LIMIT orders) |
trigger_price | The price at which an order should be triggered |
stop_loss_price | For BO Orders |
target_price | For BO Orders |
trailing_stop_loss | Only for BO Orders |
validity | Order validity (DAY,IOC, EOTODY(BSE), EOSESS(BSE) etc.) |
validity_date | Expiry date of contract |
tag | It is optional to apply to an order to identify |
Place order API
When an order is successfully placed, the API returns an order_id. The status of the order is not known at the moment of placing because of the aforementioned reasons.
Order varieties
You can place orders of different varieties-normal orders, after market orders & bracket orders etc. See the list of varieties here.
Normal order:
Sample Request(Body):
{
"action": "BUY",
"exchange": "NSE",
"token": "11536",
"order_type": "LIMIT",
"product_type": "DELIVERY",
"quantity": "1",
"disclose_quantity": "0",
"price": "3150",
"trigger_price": "0",
"stop_loss_price": "0",
"trailing_stop_loss": "0",
"validity": "DAY",
"tag": ""
}
Sample Response:
{
"status": "success",
"data": {
"message": "Order Submitted",
"order_id": "NXDAG00003H1"
}
}
AMO Order:
Sample Request(Body):
{
"action": "BUY",
"exchange": "NSE",
"token": "11536",
"order_type": "LIMIT",
"product_type": "DELIVERY",
"quantity": "5",
"disclose_quantity": "0",
"price": "3650",
"trigger_price": "0",
"stop_loss_price": "0",
"trailing_stop_loss": "0",
"validity": "DAY",
"tag": ""
}
Sample Response:
{
"status": "success",
"data": {
"message": "Order Submitted",
"order_id": "NXDAG00004G3"
}
}
BO Order:
{
"action": "BUY",
"exchange": "NSE",
"token": "11536",
"order_type": "LIMIT",
"product_type": "BO",
"quantity": "1",
"disclose_quantity": "0",
"price": "3132",
"stop_loss_price": "3050",
"trigger_price": "3090",
"target_price": "3300",
"trailing_stop_loss": "0",
"validity": "DAY",
"validity_date": "",
"tag": ""
}
Sample Response:
{
"status": "success",
"data": {
"message": "Order Submitted",
"order_id": "NXDAG00031G3"
}
}
Modify order API
As long as an order is pending in the system, certain attributes of it may be modified. It is important to send the right value for variety & order_id in the URL.
You need to add parent_order_id in the modification & cancellation of BO order URL.
Normal Order:
Sample Request(Body):
{
"exchange": "NSE",
"token": "11536",
"order_type": "LIMIT",
"quantity": "2",
"disclose_quantity": "0",
"price": "3150",
"stop_loss_price": "0",
"trigger_price": "0",
"validity": ""
}
Sample Response:
{
"status": "success",
"data": {
"message": "Order Submitted for modification",
"order_id": "NXDAG00001F3"
}
}
AMO Order:
Sample Request(Body):
{
"exchange": "NSE",
"token": "11536",
"order_type": "LIMIT",
"quantity": "6",
"disclose_quantity": "0",
"price": "3651",
"stop_loss_price": "0",
"trigger_price": "0",
"validity": "DAY"
}
Sample Response:
{
"status": "success",
"data": {
"message": "Order Submitted for modification",
"order_id": "NXDAG00004G3"
}
}
BO Order:
Sample Request(Body):
{
"exchange": "NSE",
"token": "11536",
"order_type": "LIMIT",
"quantity": "2",
"disclose_quantity": "0",
"price": "3135",
"stop_loss_price": "3050",
"trigger_price": "3090",
"target_price": "3300",
"validity": "",
"order_id": " NXDAG00031G3"
}
Sample Response:
{
"status": "success",
"data": {
"message": "Order Submitted for modification",
"order_id": "NXDAG00031G3"
}
}
Cancel order API
As long as on order is open or pending in the system, it can be cancelled.
Normal Order
Sample Response:
{
"status": "success",
"data": {
"message": "Order Submitted for cancellation",
"order_id": "NXDAG00003H1"
}
}
AMO Order:
Sample Response:
{
"status": "success",
"data": {
"message": "Order Submitted for cancellation",
"order_id": "NXDAG00004G3"
}
}
BO Order:
Sample Response:
{
"status": "success",
"data": {
"message": "Order Submitted for cancellation",
"order_id": " NXDAG00031G3"
}
}