List GTT OCO
GET /gttoco/listGttOco
Using the list OCO, we can retrieve the list of active GTT OCO, triggered GTT OCO, and expired GTT OCO.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
listType | string | true | Type of list. valid type is (active / triggered / expired). If the user does not provide a listType, by default considered as active. |
Sample Code
bash
curl -X GET 'https://tradeapi.samco.in/gttoco/listGttOco?listType=active' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-session-token: <SESSION_TOKEN>'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 {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://tradeapi.samco.in/gttoco/listGttOco?listType=active"))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("x-session-token", "<SESSION_TOKEN>")
.GET()
.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 response = await fetch('https://tradeapi.samco.in/gttoco/listGttOco?listType=active', {
method: 'GET',
headers,
});
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>',
}
r = requests.get('https://tradeapi.samco.in/gttoco/listGttOco?listType=active',
headers=headers)
print(r.json())Sample Responses
json
{
"serverTime": "04/04/24 14:18:54",
"msgId": "ec67dc5b-d626-4e16-a3eb-461ac37bb93b",
"status": "Success",
"statusMessage": "List of GTT / OCO orders received.",
"orderDetails": [
{
"summary": {
"id": 136027,
"userId": "RM1001",
"symbol": "14366_NSE",
"symbolName": "IDEA",
"orderType": "L",
"productType": "CNC",
"gttType": "SINGLE",
"validTill": "FOREVER",
"createdAt": "2024-02-28 17:52:27",
"deletedAt": "",
"gttSummaryId": "136027",
"isExpired": false,
},
"triggers": {
"gtt": {
"status": "",
"triggeredAt": "",
"triggerId": "172714",
"gttId": "172714",
"quantity": "1",
"limitPrice": "13.25",
"marketProtection": "",
"ltpAtCreation": "16.30",
"triggerPrice": "13.50",
"transactionType": "BUY",
"rejectReason": "",
"orderNumber": ""
}
}
}
]
}json
{
"serverTime": "16/05/24 18:51:28",
"status": "Failure",
"validationErrors": [
" Enter a valid listType ( active / triggered / expired)."
]
}Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
serverTime | string | Time at Server. |
msgId | string | This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request. |
status | string | The status of the API response. It can be either 'Success' or 'Failure'. |
statusMessage | string | A message describing the result of the API call. |
summary | object | Summary data for GTT orders. |
gtt | object | GTT order details available for GTT orders. |
target | object | Target details available for OCO orders. |
stopLoss | object | Stoploss details available for OCO orders. |