Place Regular Order
You can place a regular order with the placeOrder API. All the parameters that needs to be passed are listed below. An instrument token will be required to place the order, to get the instrument token you can download the given CSV file. To place a regular order, feed the execution_type parameter as 'REGULAR'.
Endpoint: /api/v1/orders
Method-Type: POST
Request Packet
{
"exchange": "NSE",
"instrument_token": "14366",
"client_id": "clientId",
"order_type": "LIMIT",
"amo": False,
"price": 13,"quantity": 1,
"disclosed_quantity": 0,
"validity": "DAY",
"product": "CNC",
"order_side": "BUY",
"device": "WEB",
"user_order_id": 1,
"trigger_price": 0,
"execution_type": "REGULAR"
}
Body Params
FieldName | Datatype | Description |
---|---|---|
exchange | String |
Name of the exchange where the order is being placed. Possible values include NSE , BSE , NFO , MCX . |
instrument_token | String |
The unique ID of the financial instrument. |
client_id | String |
The unique ID of the user placing the order. |
order_type | String |
The type of order being placed. Possible values are LIMIT , MARKET , SL , SLM . |
amo | Boolean |
Indicates whether the order is an After Market Order (AMO). It can be either TRUE or FALSE . |
price | Float |
The price at which the order should be executed. If order_type is MARKET , the value is 0 ; otherwise, it's the limit price. |
quantity | Integer |
The total quantity of the financial instrument to be traded. |
disclosed_quantity | Integer |
The quantity of the order that is hidden from the market. |
validity | String |
The validity of the order. Possible values are DAY (valid until the end of the trading day) or IOC (Immediate or Cancel). |
product | String |
The type of product being traded. Possible values are CNC (Cash and Carry), MIS (Margin Intraday Square off), NRML (Normal). |
order_side | String |
Indicates whether it's a buy or sell order. Possible values are BUY or SELL . |
device | String |
The device from which the order is being placed. Possible values are Web or Mobile . |
user_order_id | Integer |
The unique order ID generated by the user. |
trigger_price | Float |
The specified activation threshold for Stop Loss (SL) or Stop Loss Market (SLM) orders. |
execution_type | String |
The execution type of the order, which is typically REGULAR for regular orders. |
Example Code
response = pocket.placeOrder({
"exchange": "NSE",
"instrument_token": "14366",
"client_id": "clientId",
"order_type": "LIMIT",
"amo": False,
"price": 13,"quantity": 1,
"disclosed_quantity": 0,
"validity": "DAY",
"product": "CNC",
"order_side": "BUY",
"device": "WEB",
"user_order_id": 1,
"trigger_price": 0,
"execution_type": "REGULAR"
})
Response
{
"data":
{
"oms_order_id": "200018000000003"
},
"message": "Order place successfully",
"status": "success"
}
Key | Description |
---|---|
oms_order_id | The ID assigned to the order in the Order Management System. |
message | A message indicating the result of the order placement. |
status | The status of the operation (success/failure). |
Error Responses
In different scenarios, you can get different error responses, the error response will be like the below JSON example.
{
"data": {},
"error_code": 44000,
"message": "`product` is invalid",
"status": "error"
}
Various error codes can be seen depending on the errors encountered within the code. Below are some of the defined error codes.
Error Code | Description |
---|---|
44000 | In case of any of the parameter like Exchange , order_type , product being invalid |
45000 | In case of Invalid Price or Quantity . |
45010 | "Something Went Wrong" message occurs if you have given wrong instrument token |