# Order Modify

API for order modification allows users to alter an open or pending order by providing the order and any optional parameters needing adjustment if there is no opI to place an order to the exchange.

**Endpoint**

{% code title="Base URL" overflow="wrap" fullWidth="false" %}

```
https://connects.torusdigital.com/api/v1/order/modify
```

{% endcode %}

#### Header Parameters <a href="#header-parameters" id="header-parameters"></a>

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

#### **Request Parameter**

<table><thead><tr><th width="151">Parameter</th><th width="197"> Value</th><th width="72">Mandatory</th><th>Remarks</th></tr></thead><tbody><tr><td>txn_type</td><td>B/S</td><td>Y</td><td>Transaction Type</td></tr><tr><td>exchange</td><td>NSE</td><td>Y</td><td>The exchange where the transacti takes place it can be NSE/BSE </td></tr><tr><td>segment</td><td>E</td><td>Y</td><td>The market segment where E might stands for "Equity" </td></tr><tr><td>product</td><td>I</td><td>Y</td><td>The Product Type is Intraday</td></tr><tr><td>security_id</td><td>14366</td><td>Y</td><td>The unique identifier for the security being trade.</td></tr><tr><td>quantity</td><td>1</td><td>Y</td><td>Non-zero integer value</td></tr><tr><td>price</td><td>0.00</td><td>Y</td><td>Float value, cannot be zero when ORDER_TYPE is LMT/SL</td></tr><tr><td>validity</td><td>DAY</td><td>Y</td><td>The validity of the order indicate it is valid for the day</td></tr><tr><td>order_type</td><td>MKT</td><td>Y</td><td>The type of order, where "MKT" stands for a market order.</td></tr><tr><td>disc_quantity</td><td>0</td><td>N</td><td>The disclosed quantity of the order.</td></tr><tr><td>trigger_price</td><td>0.00</td><td>N</td><td>The price at which a stop order is triggered. "0.00" indicates no stop price.</td></tr><tr><td>off_mkt_flag</td><td>true</td><td>Y</td><td>true for aftermarket order, false for normal order</td></tr><tr><td>remarks</td><td>502929</td><td>N</td><td>Additional remarks or reference number for the transaction.</td></tr><tr><td>mkt_type</td><td>NL</td><td>Y</td><td>Default value  is NL</td></tr><tr><td>good_till_days_date</td><td>2019-03-29 (yyyy-MM-dd)</td><td>N</td><td>Mandatory when validity is GTD</td></tr><tr><td>encash_flag</td><td>1</td><td>N</td><td>Mandatory when using different AMO schedules</td></tr><tr><td>order_no</td><td>1234567890</td><td>Y</td><td>Order number</td></tr><tr><td>serial_no</td><td>1</td><td>Y</td><td>Serial number</td></tr><tr><td>group_id</td><td>1</td><td>Y</td><td>Group Id</td></tr><tr><td>ip</td><td>192.168.0.101</td><td>Y</td><td>IP address of client device</td></tr><tr><td>uu_id</td><td>12345678</td><td>Y</td><td>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</td></tr><tr><td>app_id</td><td>12345678</td><td>Y</td><td>App ID of client device</td></tr></tbody></table>

#### **Request**

{% tabs %}
{% tab title="curl" %}
{% code title="cURL" overflow="wrap" lineNumbers="true" %}

```javascript
curl --location 'https://connects.torusdigital.com/api/v1/order/modify' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
    "source": "M",
    "data": {
        "txn_type": "B",
        "exchange": "NSE",
        "segment": "E",
        "product": "I",
        "security_id": "14366",
        "quantity": "1",
        "price": "0.00",
        "validity": "DAY",
        "order_type": "MKT",
        "disc_quantity": "0",
        "trigger_price": "0",
        "off_mkt_flag": "false",
        "remarks": "ordModify",
        "mkt_type": "NL",
        "settlor": "X",
        "group_id": "1",
        "order_no": "1171240610104",
        "serial_no": "1",
        "ip": "192.168.0.101",
        "uu_id": "12345678",
        "app_id": "12345678"
    }
}'
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code title="Java-Unirest" fullWidth="false" %}

```java
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://connect.torusfinancemarket.com/api/v1/order/modify")
    .header("Authorization", "Bearer {{token}}")
    .header("Content-Type", "application/json")
    .body("{\r\n" +
            "    \"source\": \"M\",\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\": \"1\",\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\": \"ordModify\",\r\n" +
            "        \"mkt_type\": \"NL\",\r\n" +
            "        \"settlor\": \"X\",\r\n" +
            "        \"group_id\": \"1\",\r\n" +
            "        \"order_no\": \"1171240610104\",\r\n" +
            "        \"serial_no\": \"1\",\r\n" +
            "        \"ip\": \"192.168.0.101\",\r\n" +
            "        \"uu_id\": \"12345678\",\r\n" +
            "        \"app_id\": \"12345678\"\r\n" +
            "    }\r\n" +
            "}")
    .asString();

```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code title="Go-native" overflow="wrap" lineNumbers="true" fullWidth="true" %}

```go
package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"
)

func main() {
	url := "https://connect.torusfinancemarket.com/api/v1/order/modify"
	method := "POST"

	payload := strings.NewReader(`
{
	"source": "M",
	"data": {
		"txn_type": "B",
		"exchange": "NSE",
		"segment": "E",
		"product": "I",
		"security_id": "14366",
		"quantity": "1",
		"price": "0.00",
		"validity": "DAY",
		"order_type": "MKT",
		"disc_quantity": "0",
		"trigger_price": "0",
		"off_mkt_flag": "false",
		"remarks": "ordModify",
		"mkt_type": "NL",
		"settlor": "X",
		"group_id": "1",
		"order_no": "1171240610104",
		"serial_no": "1",
		"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("Error creating request:", 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("Error making request:", err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println("Error reading response:", err)
		return
	}

	fmt.Println("Response:", string(body))
}
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code overflow="wrap" %}

```javascript
var settings = {
  "url": "https://connect.torusfinancemarket.com/api/v1/order/modify",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer {{token}}",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({
    "source": "M",
    "data": {
      "txn_type": "B",
      "exchange": "NSE",
      "segment": "E",
      "product": "I",
      "security_id": "14366",
      "quantity": "1",
      "price": "0.00",
      "validity": "DAY",
      "order_type": "MKT",
      "disc_quantity": "0",
      "trigger_price": "0",
      "off_mkt_flag": "false",
      "remarks": "ordModify",
      "mkt_type": "NL",
      "settlor": "X",
      "group_id": "1",
      "order_no": "1171240610104",
      "serial_no": "1",
      "ip": "192.168.0.101",
      "uu_id": "12345678",
      "app_id": "12345678"
    }
  }),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endcode %}
{% endtab %}
{% endtabs %}

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "status": "success",
    "message": "Order modification request submitted successfully. Your Order Ref No. 1122031117658",
    "data": [
        {
            "order_no": "1122031117658"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

&#x20;   **Response Parameter**

| Parameter | Description                                    |
| --------- | ---------------------------------------------- |
| Status    | “success”                                      |
| Message   | “Some Message”                                 |
| Data      | An object containing the details of the order. |
| order\_no | Order specific identification number.          |
