List Basket
GET basket/listBasket
This API lets you see all the trading baskets you have. Each basket shows the trades inside it, its status (like executed, not executed, or all), and when it was created.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
listType | string | true | The listType parameter defaults to 'ALL' if not specified. Valid values include 'ALL,' 'EXECUTED,' and 'NOT EXECUTED.' |
Sample Code
bash
curl -X GET 'https://tradeapi.samco.in/basket/listBasket?listType=NOT EXECUTED' \
-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/basket/listBasket?listType=NOT EXECUTED"))
.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/basket/listBasket?listType=NOT EXECUTED', {
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/basket/listBasket?listType=NOT EXECUTED',
headers=headers)
print(r.json())Sample Responses
json
{
"serverTime": "09/08/24 11:42:06",
"msgId": "d27758a6-48b2-43d1-bbd0-6be6c1c75948",
"status": "Success",
"statusMessage": "List of Baskets fetched successfully",
"basketList": [
{
"basketId": 64,
"basketName": "NIFTY FO",
"totalOrders": 0,
"maxOrders": 100,
"executedOrders": 0,
"displayOrder": 63,
"requiredMargin": "0.00",
"finalMargin": "0.00",
"isreArranged": false,
"deletedContracts": 0,
"createdAt": "2024-08-08 19:06:22",
"updatedAt": "",
"basketStatus": "NOT EXECUTED",
"chronologicalView": true
},
]
}json
{
"serverTime": "09/08/24 11:48:59",
"status": "Failure",
"validationErrors": [
" Please enter a valid listType - ALL / EXECUTED / NOT EXECUTED "
]
}Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
serverTime | string | Time at Server. |
msgId | string | Unique identifier for every request. Please quote this identifier to the support team if you face issues with the API request. |
status | string | Status of the order cancellation request. Can be 'success' or 'failure'. |
statusMessage | string | Status message for the order cancellation request. |
basketList | Array of Objects | List of baskets with details about each basket. |
basketId | string | Unique identifier for the basket. |
basketName | string | The name given to the basket, representing its purpose or content. |
totalOrders | string | The total number of orders currently placed within this basket. |
maxOrders | string | The maximum number of orders allowed in this basket. |
executedOrders | string | The number of orders within the basket that have been executed. |
displayOrder | string | The order in which this basket should be displayed in the list. A lower number usually means higher priority. |
requiredMargin | string | The margin required for the orders in this basket, in the account's currency. |
finalMargin | string | The final margin calculated after considering the orders in the basket, also in the account's currency. |
isreArranged | string | Flag indicating whether the orders in the basket have been rearranged (true) or not (false). |
deletedContracts | string | The number of contracts that have been deleted from the basket. |
createdAt | string | The date and time when the basket was created. |
updatedAt | string | The date and time when the basket was last updated. This field is empty if the basket has not been updated since creation. |
basketStatus | string | The current status of the basket, indicating whether it has been executed ("EXECUTED") or not ("NOT EXECUTED"). |
chronologicalView | string | Indicates whether the orders in the basket are displayed in chronological order (true) or not (false). |