Orders

The order APIs allows you to place orders of different varieties like normal orders, after market orders & stoploss orders, BO orders.

MethodAPIsEndpointDescription
POSTPlace Order/orders/:varietyTo place an order of a particular variety
PUTModify Order/orders/:variety/:order_idTo modify a pending order
DELETECancel Order/orders/:variety/:order_idTo cancel a pending order

Order Constants

Here are several of the constant enum values used for placing orders.

ParameterValueDescription
varietynormalNormal Order (Regular)
amoAfter market order
boBO (Bracket Order)
actionBUYBuy
SELLSell
order_typeLIMITLimit Order(L)
MARKETMarket Order(MKT)
STOPLOSS_LIMITStop Loss Limit Order(SL)
STOPLOSS_MARKETStop Loss Market Order(SL-M)
product_typeDELIVERYCash & Carry for equity
INTRADAYMargin & Intraday Squareoff
CARRYFORWARDNormal for futures and options
BOBracket Order
validityDAYRegular Order
IOCImmediate or Cancel
EOTODYEnd of Today (BSE)
EOSESSEnd of Session (BSE)
exchangeNSENSE Cash
BSEBSE Cash
NFONSE Future and Options
NSECDNSE Currency Futures & Options
MCXMCX Futures

Order Parameters

These parameters are common across different order varieties.

ParmatersDescription
varietyDifferent order varieties (NORMAL, AMO,BO etc.)
actionBUY or SELL
exchangeName of the Exchange
tokenSymbol Token is unique identifier
order_typeOrder Type (MARKET, LIMIT etc)
product_typeProduct type (DELIVERY, INTRADAY etc.)
quantityQuantity to transact
disclose_quantityQuantity to disclose publicly (for equity trades)
priceThe min or max price to execute the order at(for LIMIT orders)
trigger_priceThe price at which an order should be triggered
stop_loss_priceFor BO Orders
target_priceFor BO Orders
trailing_stop_lossOnly for BO Orders
validityOrder validity (DAY,IOC, EOTODY(BSE), EOSESS(BSE) etc.)
validity_dateExpiry date of contract
tagIt 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"
  }
}