Skip to main content

Modify Order V3 Sandbox Enabledโ€‹

API to modify an open or pending order. To perform a modification, the orderId is a required field. Along with the orderId, you should include any optional parameters that require modification. If no optional parameters are included in the modification request, the default values will be assumed from the original order.

Additionally this API 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 --request PUT 'https://api-hft.upstox.com/v3/order/modify' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"quantity": 2,
"validity": "DAY",
"price": 16.8,
"order_id": "240108010918222",
"order_type": "LIMIT",
"disclosed_quantity": 0,
"trigger_price": 16.9,
"market_protection": 0
}'

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


Request Bodyโ€‹

NameRequiredTypeDescription
quantityfalseinteger (int32)Quantity with which the order was placed
validitytruestringOrder validity (DAY- Day and IOC- Immediate or Cancel (IOC) order).
Possible values: DAY, IOC.
pricetruenumber (float)Price at which the order was placed
order_idtruestringThe order ID for which the order must be modified. 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
LIMILT refers to Limit Order
SL refers to Stop Loss Limit
SL-M refers to Stop Loss Market.
Possible values: MARKET, LIMIT, SL, SL-M.
disclosed_quantityfalseinteger (int32)Indicates the volume to be displayed in the market depth. If provided, this value must be non-zero.
trigger_pricetruenumber (float)If the order is a stop loss order then the trigger price to be set is mentioned here
market_protectionfalseinteger (int32)Applicable for Market and Stoploss Market (SL-M) orders. This will be ignored if used with Limit or Stoploss Limit (SL) orders.
0 = No market protection (default);
0 โ€“ 25 = Custom market protection percentage (e.g. 2 for 2%);
-1 = Automatic market protection as per guidelines. For more details, see Market Protection details.
Responses

Response Bodyโ€‹

{
"status": "success",
"data": {
"order_id": "1644490272000"
},
"metadata": {
"latency": 40
}
}
NameTypeDescription
statusstringA string indicating the outcome of the request. Typically success for successful operations.
dataobjectResponse data for modify order request
data.order_idstringOrder ID
metadataobjectOrder metadata associated with successful order modified.
metadata.latencyintegerThe overall time taken by API platform to process the order modification request, measured in milliseconds.

Sample Codeโ€‹

Modify a delivery orderโ€‹

import requests

url = 'https://api-hft.upstox.com/v3/order/modify'
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}

data = {
'quantity': 3,
'validity': 'DAY',
'price': 16.8,
'order_id': '240108010918222',
'order_type': 'LIMIT',
'disclosed_quantity': 0,
'trigger_price': 16.9
}

response = requests.put(url, headers=headers, json=data)
print(response.text)
Loading...