Order Cancel
This API cancels open or pending orders, including AMO and regular orders, and assists in exiting COs, offering traders a streamlined solution for order management.
Endpoint
https://connects.torusdigital.com/api/v1/order/cancelHeader Parameters
Content-Type
application/json
Authorization
Bearer <token>
Request Parameter
txn_type
B/S
Y
The type of transaction, where "B" typically stands for Buy and "S" stands for SELL.
exchange
NSE
Y
The exchange where the transaction takes place, it can be NSE/BSE.
segment
E
Y
The market segment, where "E" might stand for "Equity".
product
I
Y
The product type is intraday.
security_id
14366
Y
The unique identifier for the security being traded.
quantity
2
Y
Non-zero integer value
price
0.00
Y
Float value, cannot be zero when ORDER_TYPE is LMT/SL
validity
DAY
Y
The validity of the order, indicating it is valid for the day.
order_type
MKT
Y
The type of order, where "MKT" stands for a market order.
disc_quantity
0
N
The disclosed quantity of the order.
trigger_price
0.00
N
The price at which a stop order is triggered. "0.00" indicates no stop price.
off_mkt_flag
false
Y
true for Aftermarket order, false for normal order
remarks
502929
N
Additional remarks or reference number for the transaction.
mkt_type
NL
Y
Default value is NL
good_till_days_date
2019-03-29 (yyyy-MM-dd)
N
Mandatory when validity is GTD
order_no
1234567890
Y
Order number
serial_no
1
Y
Serial number
group_id
1
Y
Group Id
ip
192.168.0.101
Y
IP address of client device
uu_id
12345678
Y
This random ID is to be generated and persisted on a device when a user installs or initializes the app (Mobile or EXE) for the first time
app_id
12345678
Y
App ID of client device
Request
curl --location 'https://connects.torusdigital.com/api/v1/order/cancel' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
"source": "N",
"data": {
"txn_type": "B",
"exchange": "NSE",
"segment": "E",
"product": "I",
"security_id": "14366",
"quantity": "3",
"price": "0.00",
"validity": "DAY",
"order_type": "MKT",
"disc_quantity": "0",
"trigger_price": "0",
"off_mkt_flag": "false",
"remarks": "Trail",
"mkt_type": "null",
"settlor": "X",
"group_id": "1",
"order_no": "1141240610104",
"serial_no": "2",
"ip": "192.168.0.101",
"uu_id": "12345678",
"app_id": "12345678"
}
}'Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://connects.torusdigital.com/api/v1/order/cancel")
.header("Authorization", "Bearer {{token}}")
.header("Content-Type", "application/json")
.body("{\r\n" +
" \"source\": \"N\",\r\n" +
" \"data\": {\r\n" +
" \"txn_type\": \"B\",\r\n" +
" \"exchange\": \"NSE\",\r\n" +
" \"segment\": \"E\",\r\n" +
" \"product\": \"I\",\r\n" +
" \"security_id\": \"14366\",\r\n" +
" \"quantity\": \"3\",\r\n" +
" \"price\": \"0.00\",\r\n" +
" \"validity\": \"DAY\",\r\n" +
" \"order_type\": \"MKT\",\r\n" +
" \"disc_quantity\": \"0\",\r\n" +
" \"trigger_price\": \"0\",\r\n" +
" \"off_mkt_flag\": \"false\",\r\n" +
" \"remarks\": \"Trail\",\r\n" +
" \"mkt_type\": \"null\",\r\n" +
" \"settlor\": \"X\",\r\n" +
" \"group_id\": \"1\",\r\n" +
" \"order_no\": \"1141240610104\",\r\n" +
" \"serial_no\": \"2\",\r\n" +
" \"ip\": \"192.168.0.101\",\r\n" +
" \"uu_id\": \"12345678\",\r\n" +
" \"app_id\": \"12345678\"\r\n" +
" }\r\n" +
"}")
.asString();go
Copy code
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
url := "https://connects.torusdigital.com/api/v1/order/cancel"
method := "POST"
payload := strings.NewReader(`
{
"source": "N",
"data": {
"txn_type": "B",
"exchange": "NSE",
"segment": "E",
"product": "I",
"security_id": "14366",
"quantity": "3",
"price": "0.00",
"validity": "DAY",
"order_type": "MKT",
"disc_quantity": "0",
"trigger_price": "0",
"off_mkt_flag": "false",
"remarks": "Trail",
"mkt_type": "null",
"settlor": "X",
"group_id": "1",
"order_no": "1141240610104",
"serial_no": "2",
"ip": "192.168.0.101",
"uu_id": "12345678",
"app_id": "12345678"
}
}
`)
client := &http.Client{}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer {{token}}")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}var settings = {
"url": "https://connects.torusdigital.com/api/v1/order/cancel",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}",
"Content-Type": "application/json"
},
"data": JSON.stringify({
"source": "N",
"data": {
"txn_type": "B",
"exchange": "NSE",
"segment": "E",
"product": "I",
"security_id": "14366",
"quantity": "3",
"price": "0.00",
"validity": "DAY",
"order_type": "MKT",
"disc_quantity": "0",
"trigger_price": "0",
"off_mkt_flag": "false",
"remarks": "Trail",
"mkt_type": "null",
"settlor": "X",
"group_id": "1",
"order_no": "1141240610104",
"serial_no": "2",
"ip": "192.168.0.101",
"uu_id": "12345678",
"app_id": "12345678"
}
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});Response
{
"data": [
{
"order_no": "1122031118517"
}
],
"status": "success",
"message": "Order cancellation request submitted successfully. Your Order Ref No. 1122031118517"
}
Response Parameter
Status
“success”/”error”
Message
“Some Message”
Data
An object containing the details of the order.
order_no
Order specific identification number.
Last updated