Skip to main content

Place Order V3 Sandbox Enabledโ€‹

API to place an order to the exchange. The instrument_token required for the stock or contracts should be obtained from the BOD instruments.

Upon successfully placing the order with the exchange, a unique order_id is provided in the success response, which can be utilized for order modification or cancellation. If you intend to place an order outside of market hours, the 'is_amo' (After Market Order) should be set to 'true'. You can assign a tag(unique identifier) to your order, allowing you to retrieve orders associated with that tag using the Order History API.

Featuring an auto-slicing capability to break down large orders into smaller sizes bases on the freeze quantity of the instrument. You can enable or disable this feature by setting the slice flag in your order. For more details, please refer to the Auto Slicing

This API also includes latency information in the meta data object of the response, providing insight into the time Upstox took to process your request.


Requestโ€‹

curl --location 'https://api-hft.upstox.com/v3/order/place' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"quantity": 4000,
"product": "D",
"validity": "DAY",
"price": 0,
"tag": "string",
"instrument_token": "NSE_FO|43919",
"order_type": "MARKET",
"transaction_type": "BUY",
"disclosed_quantity": 0,
"trigger_price": 0,
"is_amo": false,
"slice": true
}'

For additional samples in various languages, please refer to the Sample code section on this page.

Request Bodyโ€‹

NameRequiredTypeDescription
quantitytrueinteger (int32)Quantity with which the order is to be placed.
For commodity - number of lots is accepted.
For other Futures & Options and equities - number of units is accepted in multiples of the tick size.
producttruestringSignifies if the order was either Intraday or Delivery.
Possible values: I, D, MTF.
validitytruestringIt can be one of the following - DAY(default), IOC.
Possible values: DAY, IOC.
pricetruenumber (float)Price at which the order will be placed
tagfalsestringTag for a particular order
instrument_tokentruestringKey of the instrument. For the regex pattern applicable to this field, see the Field Pattern Appendix.
order_typetruestringType of order. It can be one of the following MARKET refers to market order LIMIT refers to Limit Order SL refers to Stop Loss Limit SL-M refers to Stop Loss Market.
Possible values: MARKET, LIMIT, SL, SL-M.
transaction_typetruestringIndicates whether its a buy or sell order.
Possible values: BUY, SELL.
disclosed_quantitytrueinteger (int32)The quantity that should be disclosed in the market depth
trigger_pricetruenumber (float)If the order is a stop loss order then the trigger price to be set is mentioned here
is_amotruebooleanSignifies if the order is an After Market Order
slicefalsebooleanWhen true, the number of orders is calculated based on the freeze quantity assigned for the instrument by the exchange. This helps automatically split the order into smaller parts in accordance with exchange rules, preventing rejection due to exceeding the allowed quantity. The default value is false. For a detailed explanation, please check the Auto Slicing section.

When slicing is applied, we calculate the total number of resulting orders. The total number of orders generated by the slice, must not exceed the maximum order count specified here.

Responses

Response Bodyโ€‹

{
"status": "success",
"data": {
"order_ids": [
"1644490272000",
"1644490272001",
"1644490272003"
]
},
"metadata": {
"latency": 30
}
}
NameTypeDescription
statusstringA string indicating the outcome of the request. Typically success for successful operations.
dataobjectResponse data for place order request.
data.order_idsarrayList of reference order IDs associated with successful order placed.
metadataobjectOrder metadata associated with successful order placed.
metadata.latencyintegerThe overall time taken by API platform to process the order request, measured in milliseconds.

Auto Slicingโ€‹

Exchanges enforce a limitation on the maximum quantity that can be placed for any scrip, known as the freeze quantity. If an order exceeds this freeze quantity, it will be rejected by the exchange. To simplify the process and prevent such rejections, we automatically slice the order into smaller parts based on the freeze quantity defined by the exchange when necessary.

How to Enable Slicingโ€‹

To enable this feature, include the slice field in your request payload with the value set to true. Let's walk through a practical example:

Suppose you want to place an order for SCRIP1 with a total quantity of 10,100, and the freeze quantity defined by the exchange is 1,000. If you send the slice field as false, the entire order is submitted to the exchange, which will reject it due to exceeding the allowed quantity. However, if you pass true as the value for the slice field, we automatically split the order into 11 smaller orders: 10 orders of 1,000 units each, and 1 order of 100 units. This ensures that all orders are accepted and processed by the exchange.


Sample Codeโ€‹

Place an order with slicing enabledโ€‹

curl --location 'https://api-hft.upstox.com/v3/order/place' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"quantity": 4000,
"product": "D",
"validity": "DAY",
"price": 0,
"tag": "string",
"instrument_token": "NSE_FO|43919",
"order_type": "MARKET",
"transaction_type": "BUY",
"disclosed_quantity": 0,
"trigger_price": 0,
"is_amo": false,
"slice": true
}'

Place an order with slicing disabledโ€‹

curl --location 'https://api-hft.upstox.com/v3/order/place' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"quantity": 25,
"product": "D",
"validity": "DAY",
"price": 0,
"tag": "string",
"instrument_token": "NSE_FO|43919",
"order_type": "MARKET",
"transaction_type": "BUY",
"disclosed_quantity": 0,
"trigger_price": 0,
"is_amo": false,
"slice": false
}'

Loading...