Delete GTT
Deleting a GTT order cancels it before execution, removing it from the exchange's order book and preventing future execution. Once GTT is triggered, deletion is not possible.
DELETE /gttoco/deleteGtt
Steps to Delete a GTT (Good Till Trigger) order :
- Retrieve all active GTT orders using the List GTT OCO API. In the 'List GTT OCO ' API response, we will get both active GTT and GTT OCO orders. To identify an GTT order, check if the 'triggers' key in the API response contains 'gtt' key. If it does, then it is an GTT order.
- Note down the GTT summary ID of the order you wish to delete.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
gttSummaryId | number | true | Enter the gttSummaryId of the GTT order you want to delete here. |
Sample Request Body
json
requestBody={
"gttSummaryId" : 136045
}Live trading endpoint
This sample sends a real request against your trading account. Replace <SESSION_TOKEN> and review every field before running — Samco does not provide a sandbox, and any successful call affects live positions and balances.
Sample Code
bash
curl -X DELETE 'https://tradeapi.samco.in/gttoco/deleteGtt' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-session-token: <SESSION_TOKEN>' \
-d '{"gttSummaryId":136045}'java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Sample {
public static void main(String[] args) throws Exception {
String requestBody = """
{
"gttSummaryId": 136045
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://tradeapi.samco.in/gttoco/deleteGtt"))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("x-session-token", "<SESSION_TOKEN>")
.method("DELETE", HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response =
client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}js
(async () => {
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-session-token': '<SESSION_TOKEN>',
};
const requestBody = {
gttSummaryId: 136045
};
const response = await fetch('https://tradeapi.samco.in/gttoco/deleteGtt', {
method: 'DELETE',
headers,
body: JSON.stringify(requestBody),
});
const data = await response.json();
console.log(data);
})();py
import requests
import json
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-session-token': '<SESSION_TOKEN>',
}
requestBody = {
"gttSummaryId": 136045
}
r = requests.delete('https://tradeapi.samco.in/gttoco/deleteGtt',
data=json.dumps(requestBody),
headers=headers)
print(r.json())Sample Responses
json
{
"serverTime": "28/02/24 12:49:19",
"status": "Success",
"msgId": "a62afb04-84a5-4d3d-ba5b-3299cce4fd77",
"gttSummaryId": "136045",
"statusMessage": "GTT order Deleted",
"orderDetails": {
"userId": "RM1001"
}
}Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
serverTime | string | Time at Server. |
msgId | string | A unique identifier for the API response message. This can be useful for tracking or debugging purposes. |
status | string | The status of the API response. It can be either 'Success', 'Error' or 'Failure' |
statusMessage | string | A message describing the result of the API call. |
gttSummaryId | string | gttSummaryId of the order which is deleted. |
userId | string | User ID of the user who deleted the order. |